I have two instances of PHP running parallel

I have two instances of PHP running parallel

by Madhukar Boppidi -
Number of replies: 13
HI,

I have two instances of PHP running parallel. How can I uninstall compete php instances on Redhat Linux server.

I am looking for respective commands.

Thanks,
Madhukar
Average of ratings: -
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I very much doubt it..

Why do you think this is your problem? What is going wrong?
In reply to Howard Miller

Re: I have two instances of PHP running parallel

by Madhukar Boppidi -
Since I am pointing to PHP version 7.3.12 but when I do php version info it is showing as 7.4.0.

First I have installed 7.4.0 but unfortunately moodle is not supporting that version so I installed 7.3.12 which moodle recommended ,but still when i look for version information it is showing as 7.4.0
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
How are you checking the version? Is this the Moodle installer?

How did you install PHP? Are you sure the 'downgrade' to 7.3 actually worked?
In reply to Howard Miller

Re: I have two instances of PHP running parallel

by Madhukar Boppidi -
Hi,

I did not downgraded from 7.4 to 7.3 , I just uninstalled 7.4 and I installed 7.3.12 . Yes this is Moodle Installer.

./php -version
PHP 7.4.0 (cli) (built: Dec 6 2019 17:12:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Ken Task -
Picture of Particularly helpful Moodlers

Please issue:

uname -an

yum repolist

cat /etc/redhat-release

So we can find out info about server ... true RedHat Enterprise (commercial) or CentOS - 7 or 8?

Are you remotely hosted?  Dedicated VPS or shared?    Providers do offer application via cPanel/other for customers to use different versions of PHP per directory.

Above info would make a difference in giving specific commands for installing/un-installing etc. PHP - or seeing what's available via package manager (yum) and which/what repo.

'SoS', Ken


In reply to Ken Task

Re: I have two instances of PHP running parallel

by Madhukar Boppidi -
Hi Ken,

Thanks for your response , please find the output below.

[root@prdlmsmo01 ~]# uname -an
Linux prdlmsmo01.uhip.ri.gov 3.10.0-1062.1.1.el7.x86_64 #1 SMP Tue Aug 13 18:39:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@prdlmsmo01 ~]# yum repolist
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos,
: subscription-manager
Repository rhel-7-server-optional-rpms is listed more than once in the configuration
Repository rhel-7-server-rpms is listed more than once in the configuration
repo id repo name status
!UHIP_Cisofy_lynis-client-rpm-noarch lynis-client-rpm-noarch 41
!UHIP_Puppet_puppet-agent-el7-x86_64 puppet-agent-el7-x86_64 157
epel Extra Packages for Enterprise Linux 7 13,384
ius/x86_64 IUS for Enterprise Linux 7 - x86_64 714
local-7 Local 7 5
puppet5 Puppet 5 Repository el 7 184
remi-safe Safe Remi's RPM repository for Enterpri 3,653
!rhel-7-server-extras-rpms/x86_64 Red Hat Enterprise Linux 7 Server - Ext 1,182
!rhel-7-server-optional-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server - Opt 19,192
!rhel-7-server-rh-common-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server - RH 239
!rhel-7-server-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server (RPMs 26,283
!rhel-7-server-satellite-tools-6.5-rpms/x86_64 Red Hat Satellite Tools 6.5 (for RHEL 7 62
repolist: 65,096
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager
[root@prdlmsmo01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The command line php command is NOT the same as the web-based one. They can be different versions. Are you using the web installer or the command-line installer.

When you uninstalled 7.4 and installed 7.3 (I would call that downgrading but whatever) did you do this for both the command line and the web versions?
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Ken Task -
Picture of Particularly helpful Moodlers

Noticed your command for checking version had ./ in front of php.  ./ means present working directory.  What directory were you in?

Best (?) to use: which php

That will show which cli php system finds ... or at least one of them - first one in environment path of root user.

If it shows: /usr/bin/php

Then try command with /usr/bin/php -v

What do you get?

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: I have two instances of PHP running parallel

by Madhukar Boppidi -
I am not getting nothing.

[root@prdlmsmo01 bin]# ./php -v
-bash: ./php: No such file or directory
[root@prdlmsmo01 bin]# pwd
/usr/bin

But WHEN I EXECUTE from apache bin I am getting following results.

[root@prdlmsmo01 apache]# cd bin/
[root@prdlmsmo01 bin]# ./php -version
PHP 7.4.0 (cli) (built: Dec 6 2019 17:12:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
[root@prdlmsmo01 bin]# pwd
/opt/apache/bin
[root@prdlmsmo01 bin]#
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Ken Task -
Picture of Particularly helpful Moodlers

Well, you have true RedHat Enterprise 7 (commercial).
Do maintain your subscriptions to the repos for it.
When those subscriptions expire, no updates possible.

Can see some things you need to investigate and fix:

Repository rhel-7-server-optional-rpms is listed more than once in the configuration
Repository rhel-7-server-rpms is listed more than once in the configuration

should be listed only once to avoid package manager confusion.

Can also see you are using third party repos:
epel Extra Packages for Enterprise Linux 7 13,384
remi-safe Safe Remi's RPM repository for Enterpri 3,653
ius/x86_64 IUS for Enterprise Linux 7 - x86_64 714

cisofy for auditing-hardening compliance?   Guess cause .gov domain.

First, the php cli should be found from anywhere on the system - unless cisofy has
done something to system.
So ... from any location on server, like in /root right after you login as root,
one should be able to do: php -v
and see php (cli) version.

Find out which php is found first using:

which php

That is dependent upon env paths.
As root, env |grep PATH [ENTER] - case sensitive.

The various directories in the paths are separated by a ':'
Example from CentOS 7 (not same as your server):

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

So if I use just php -v the path above would be searched in order seen for a php executable.

Since you have apache installed in /opt/ (it appears).
You could also have multiple versions of php in /opt/

find / -name php

will take a long time to execute, but that command should show php locations in your entire system.

NOT all of what that shows is the CLI php.
Mine, for example, a CentOS 7 (not RHEL 7), shows a few like:

/usr/lib64/google-cloud-sdk/platform/ext-runtime/php
/usr/lib64/php
/usr/share/logwatch/scripts/services/php
/usr/share/php
/usr/include/php-zts/php
/usr/include/php

NONE of those found above are php executables ... lib64,share,include aren't places where linux normally puts executables.

Looking for /something/bin/ directories

On my CentOS 7 system, above finds one:
/usr/bin/php

If I type full path to php with -v switch:

[root@sos]# /usr/bin/php -v
PHP 7.1.33 (cli) (built: Oct 26 2019 10:16:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

That's what you are looking for.

Also, system keeps a history of commands issued.  Assuming you used yum to install php and if the history is still there, issue:

 history |grep yum

should show the yum command you used to install php.

'SoS', Ken


In reply to Ken Task

Re: I have two instances of PHP running parallel

by Madhukar Boppidi -
Hi Ken,

this is what i see in my server.

[root@prdlmsmo01 opt]# find / -name php
/opt/apache/lib/php
/opt/apache/bin/php
/opt/apache/include/php
/opt/apache/htdocs/moodle_do_not_use/lib/mlbackend/php
/opt/apache/htdocs/moodle_bkp/lib/mlbackend/php
/opt/apache/htdocs/moodle/lib/mlbackend/php
/opt/apache/php
/opt/apache/php-7.3.12/sapi/cli/php
/opt/apache/php-7.4.0/sapi/cli/php
/opt/apache/usr/local/lib/php
/opt/apache/usr/local/bin/php
/opt/apache/usr/local/php
/opt/apache/usr/local/include/php
/opt/remi/php74/root/usr/lib64/php
/opt/moodle/apache/lib/php
/opt/moodle/apache/bin/php
/opt/moodle/apache/include/php
/opt/moodle/apache/htdocs/moodle/lib/mlbackend/php
/opt/moodle/apache/php
/usr/share/php
/usr/local/bin/php
/usr/local/include/php
/usr/local/lib/php
/usr/local/php7/lib/php
/usr/local/php7/bin/php
/usr/local/php7/php
/usr/local/php7/include/php
/usr/local/php
[root@prdlmsmo01 opt]# /usr/local/bin/php -v
PHP 7.4.0 (cli) (built: Dec 12 2019 16:23:37) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
[root@prdlmsmo01 opt]#
In reply to Madhukar Boppidi

Re: I have two instances of PHP running parallel

by Ken Task -
Picture of Particularly helpful Moodlers

First ... you need to get training or find a resource for how to admin your RHEL 7 server.   These forums are supposed to be about moodle.

With that **strong sugggestion** in mind ...

** you are looking for 'bin' directories.

You've shown only the one found in
/usr/local/bin/php -v
is 7.4.0 (cli)

What does:
/usr/local/php7/bin/php -v
show?

What does:
/opt/apache/php-7.3.12/sapi/cli/php -v
show
I would assume (maybe incorrectly) 'sapi' means 'secure api'???? and that
/opt/apache/php-7.3.12/sapi/cli/php -v
would show PHP 7.3.12 (cli)

What of how installed (yum package manager or other)?

System keeps a history of commands issued.

history |grep yum

Looking for yum commands you issued to install software and *in particular* PHP and possibly apache.

Remember, the goal is to find a compatible version of php-cli ... that's php-cli ... repeat ... that's php-cli.

In your Moodle config then you will know what path to set for php-cli.   And also what path to php executable for your cron job for the moodle which is set outside of Moodle config.

'SoS', Ken