Seravo / wordpress

The WordPress project layout used by many of Seravo's customers, suitable also for local development with Vagrant and git deployment
https://seravo.com
GNU General Public License v3.0
102 stars 54 forks source link

Switching to PHP 5.6 causes an internal server error with no log output #125

Closed k1sul1 closed 4 years ago

k1sul1 commented 4 years ago

PHP 5.6 might be dead but lots of sites still run it, and when you try to run them on 7.3, about 200 notices appear, so being able to run them on 5.6 is pretty helpful whilst upgrading them to run on latest version.

It doesn't work in dockered version.

vagrant@development:/data/wordpress/htdocs$ vim /data/wordpress/nginx/php.conf # :%s/7.3/5.6
vagrant@development:/data/wordpress/htdocs$ wp-restart-nginx
Testing nginx configuration...
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
==> Check PHP backends:
Found PHP mode definition: php5.6 in '/data/wordpress/nginx/php.conf'
Using php5.6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! WARNING: PHP 5.6 is deprecated, security support has ended 31th December 2018!!
!                                                                               !
! See <https://seravo.com/docs/configuration/php7-hhvm/> for more details.      !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====> Activating PHP5.6
update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in manual mode
update-alternatives: using /usr/bin/phar5.6 to provide /usr/bin/phar (phar) in manual mode
update-alternatives: using /usr/bin/phar.phar5.6 to provide /usr/bin/phar.phar (phar.phar) in manual mode
Restarting PHP (PID 857 863)
Restarted PHP (PID 857 863)
Restarting Nginx (PID 858)...
Success: Restarted Nginx (PID 1054)
vagrant@development:~$ curl localhost
<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
vagrant@development:~$ 
ottok commented 4 years ago

For more information on error 500, see /data/log/php-error.log

k1sul1 commented 4 years ago

As the title says, no log output.

vagrant@development:~$ echo "" > /data/log/php-error.log
vagrant@development:~$ vim /data/wordpress/nginx/php.conf
vagrant@development:~$ cat /data/wordpress/nginx/php.conf
##
# Define PHP version in use
# See: https://seravo.com/docs/configuration/php7-hhvm/
##
set $mode php5.6;
vagrant@development:~$ wp-restart-nginx
Testing nginx configuration...
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
==> Check PHP backends:
Found PHP mode definition: php5.6 in '/data/wordpress/nginx/php.conf'
Using php5.6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! WARNING: PHP 5.6 is deprecated, security support has ended 31th December 2018!!
!                                                                               !
! See <https://seravo.com/docs/configuration/php7-hhvm/> for more details.      !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====> Activating PHP5.6
update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in manual mode
update-alternatives: using /usr/bin/phar5.6 to provide /usr/bin/phar (phar) in manual mode
update-alternatives: using /usr/bin/phar.phar5.6 to provide /usr/bin/phar.phar (phar.phar) in manual mode
Restarting PHP (PID 779 781 787 788 827)
Restarted PHP (PID 779 781 788 827)
Restarting Nginx (PID 786)...
Success: Restarted Nginx (PID 956)
vagrant@development:~$ cat /data/log/php-error.log

vagrant@development:~$ curl localhost
<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
vagrant@development:~$ cat /data/log/php-error.log

vagrant@development:~$
ottok commented 4 years ago

What about /data/wordpress/htdocs/wp-content/debug.log or some other location?

k1sul1 commented 4 years ago

Empty. nginx-error.log has something, but nothing useful really.

vagrant@development:~$ cat /data/wordpress/htdocs/wp-content/debug.log

vagrant@development:~$ cat /data/log/
bootstrap.log     nginx-access.log  nginx-error.log   php-error.log     redis.log         runit.log         system/           wp-login.log
vagrant@development:~$ cat /data/log/nginx-error.log
2020/01/02 17:22:58 [error] 1055#1055: *11 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "chydenius.local"
2020/01/02 17:23:00 [error] 1056#1056: *13 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "chydenius.local"
2020/01/02 17:23:10 [error] 1055#1055: *17 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET /wp-admin/ HTTP/1.1", host: "chydenius.local"
2020/01/02 17:28:49 [error] 1056#1056: *18 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "localhost"
2020/01/07 11:24:45 [error] 958#958: *10 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET /wp-admin/ HTTP/1.1", host: "chydenius.local", referrer: "https://chydenius.local/wp-login.php"
2020/01/07 11:24:58 [error] 959#959: *13 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", host: "localhost"
2020/01/07 11:51:17 [error] 958#958: *17 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET /wp-admin/ HTTP/1.1", host: "chydenius.local", referrer: "https://chydenius.local/wp-login.php"
2020/01/07 11:51:27 [error] 959#959: *19 no port in upstream "php5.6", client: 127.0.0.1, server: _, request: "GET /wp-admin/ HTTP/1.1", host: "chydenius.local", referrer: "https://chydenius.local/wp-login.php"
vagrant@development:~$
ottok commented 4 years ago

Seems there is no PHP 5.6 at all. What about ps faxu | grep php? Or wp-restart-nginx?

k1sul1 commented 4 years ago

wp-restart-nginx output is above.

ps faxu:

image

ottok commented 4 years ago

I think I found the a bug. For wp-restart-nginx the value 'php5.6' is valid, but in reality the upstream name is 'php5' (no .6). Update your /data/wordpress/nginx to have 'php5' and it should work. Success?

k1sul1 commented 4 years ago

Success indeed.

I see 5.6 was removed from the documentation recently, does that mean it's due to be removed from the environment as well?

If so, I'd like a legacy tag to Docker Hub, for the rare occurrence of when I need to run something on 5.6 first.

ottok commented 4 years ago

PHP 5.6 is still available, but we do want to get rid of it soon.. I hope the site you are working on has some plans to make the code at least PHP 7.0 compatible.

k1sul1 commented 4 years ago

Yes, but there's going to be more of these 5.x sites in the future that are going to need porting. Hence the need for legacy tag in docker.