Page 7 of 11

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 11:24 am
by SS88
Whenever this happens, run this command to see what's wrong:

Code: Select all

systemctl status php72-php-fpm.service
pepsi wrote:
Sat Mar 17, 2018 4:07 am
SS88 wrote:
Fri Mar 16, 2018 2:06 pm
This will install PHP 7.2. It will replace old PHP versions.
...snip...
Hello. Thanks for the guide but I'm having some issues. I did all the steps and basically the problem is when I run 'php -v', I get PHP 7.2.X, but my actual websites are still running PHP 5.6 (I'm checking via phpinfo).

To go further, I followed the guide without issue up until where you say to "Start PHP-FPM". But this is what I get when I attempt that:

Code: Select all

[root@server01]# service php72-php-fpm start
Redirecting to /bin/systemctl start php72-php-fpm.service
Job for php72-php-fpm.service failed because the control process exited with error code. See "systemctl status php72-php-fpm.service" and "journalctl -xe" for details.
[root@server01]#
[root@server01]#
[root@server01]# systemctl status php72-php-fpm.service
● php72-php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php72-php-fpm.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2018-03-17 04:02:13 UTC; 8s ago
  Process: 9138 ExecStart=/opt/remi/php72/root/usr/sbin/php-fpm --nodaemonize (code=exited, status=78)
 Main PID: 9138 (code=exited, status=78)

Mar 17 04:02:13 server01 systemd[1]: Starting The PHP FastCGI Process Manager...
Mar 17 04:02:13 server01 php-fpm[9138]: [17-Mar-2018 04:02:13] ERROR: Unable to globalize '/etc/php-fpm.d/*.conf' (ret=2) from /etc/opt/remi/php72/php-fpm.conf at line 11.
Mar 17 04:02:13 server01 php-fpm[9138]: [17-Mar-2018 04:02:13] ERROR: failed to load configuration file '/etc/opt/remi/php72/php-fpm.conf'
Mar 17 04:02:13 server01 php-fpm[9138]: [17-Mar-2018 04:02:13] ERROR: FPM initialization failed
Mar 17 04:02:13 server01 systemd[1]: php72-php-fpm.service: main process exited, code=exited, status=78/n/a
Mar 17 04:02:13 server01 systemd[1]: Failed to start The PHP FastCGI Process Manager.
Mar 17 04:02:13 server01 systemd[1]: Unit php72-php-fpm.service entered failed state.
Mar 17 04:02:13 server01 systemd[1]: php72-php-fpm.service failed.
Do you have any idea what is going wrong? I did this on a fresh VestaCP install on CentOS 7. Can you verify what settings I should have chosen when running vst-install.sh? Like for WEB what should I have picked (nginx + apache, nginx + php-fpm)? I want to be running Apache as the main web server.

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 4:45 pm
by pepsi
SS88 wrote:
Sat Mar 17, 2018 11:24 am
Whenever this happens, run this command to see what's wrong:

Code: Select all

systemctl status php72-php-fpm.service
I actually already included that output in my original post you quoted.

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 4:56 pm
by SS88
So you did, sorry!

Is there anything in the /etc/php-fpm.d/ directory?
pepsi wrote:
Sat Mar 17, 2018 4:45 pm
SS88 wrote:
Sat Mar 17, 2018 11:24 am
Whenever this happens, run this command to see what's wrong:

Code: Select all

systemctl status php72-php-fpm.service
I actually already included that output in my original post you quoted.

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:00 pm
by pepsi
SS88 wrote:
Sat Mar 17, 2018 4:56 pm
So you did, sorry!

Is there anything in the /etc/php-fpm.d/ directory?
That directory actually doesn't exist for me. The closest thing I have is "/etc/php-zts.d". How should I have done the initial setup when installing via the vst-install script, specifically the WEB part? I chose "nginx + apache" because I wanted Apache - does this only work if I chose "nginx + php-fpm" ?

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:04 pm
by SS88
That's correct, nginx + apache does not use php-fpm, that uses phpfcgi.

You need to use nginx + php-fpm

I will update my first post to reflect this.


pepsi wrote:
Sat Mar 17, 2018 5:00 pm
SS88 wrote:
Sat Mar 17, 2018 4:56 pm
So you did, sorry!

Is there anything in the /etc/php-fpm.d/ directory?
That directory actually doesn't exist for me. The closest thing I have is "/etc/php-zts.d". How should I have done the initial setup when installing via the vst-install script, specifically the WEB part? I chose "nginx + apache" because I wanted Apache - does this only work if I chose "nginx + php-fpm" ?

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:09 pm
by pepsi
SS88 wrote:
Sat Mar 17, 2018 5:04 pm
That's correct, nginx + apache does not use php-fpm, that uses phpfcgi.

You need to use nginx + php-fpm

I will update my first post to reflect this.
Ah okay, thanks for clarifying. Do you happen to know how to get PHP7 going when I'm wanting to use Apache instead of nginx by chance?

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:10 pm
by SS88
I'm just doing a fresh install now to have a nosy! Will let you know what I find.
pepsi wrote:
Sat Mar 17, 2018 5:09 pm
SS88 wrote:
Sat Mar 17, 2018 5:04 pm
That's correct, nginx + apache does not use php-fpm, that uses phpfcgi.

You need to use nginx + php-fpm

I will update my first post to reflect this.
Ah okay, thanks for clarifying. Do you happen to know how to get PHP7 going when I'm wanting to use Apache instead of nginx by chance?

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:14 pm
by pepsi
SS88 wrote:
Sat Mar 17, 2018 5:10 pm
I'm just doing a fresh install now to have a nosy! Will let you know what I find.
That is awesome, thank you!

Re: HOWTO: Install PHP7 on CentOS 7

Posted: Sat Mar 17, 2018 5:25 pm
by SS88
Ok,

If you've not done anything else other than use the install commands, you can just remove this file:

/etc/httpd/conf.modules.d/10-php.conf

And restart apache. Make a backup first!


pepsi wrote:
Sat Mar 17, 2018 5:14 pm
SS88 wrote:
Sat Mar 17, 2018 5:10 pm
I'm just doing a fresh install now to have a nosy! Will let you know what I find.
That is awesome, thank you!

Re: HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7

Posted: Sat Mar 17, 2018 5:30 pm
by SS88
You also need to type these commands so the FastCGI templates work:

Code: Select all

rm -f /usr/bin/php-cgi
ln -s /usr/bin/php72-cgi /usr/bin/php-cgi