Problem with multiple PHP versions

Discussion in 'Installation/Configuration' started by Guido64, Feb 18, 2016.

  1. Guido64

    Guido64 Member

    I installed a new clean "Perfect server" based on Debian Jessie in a openvz vps on my own local home server. After that went well i installed multiple php versions Latest php 5.3, 5.4, 5.5 fpm and cgi.

    Wen i test those 3 cgi versions they all three work right away in few seconds after i change te version te test page with phpinfo(); show the correct version. But wen i want to change the fpm versions this doesn't change the verion. I have to restart the vps to make the version change work.

    Is this normal behavior or is something wrong?
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    please check your custom init-script and correct paths to make sure there are no mistakes or typos within.
    I have two different additional php configurations working like a charm, so I assume there's an issue somewhere.
     
  3. Guido64

    Guido64 Member

    i checked the init script and they look good to me but in syslog i see this:
    Feb 18 18:40:04 ispconfig systemd[1]: Unit php-5.5.32-fpm.service cannot be reloaded because it is inactive.
    Feb 18 18:40:05 ispconfig systemd[1]: Unit php-5.3.29-fpm.service cannot be reloaded because it is inactive.
    Feb 18 18:40:05 ispconfig systemd[1]: Stopping LSB: Apache2 web server...
    Feb 18 18:40:07 ispconfig apache2[2985]: Stopping web server: apache2.
    Feb 18 18:40:07 ispconfig systemd[1]: Starting LSB: Apache2 web server...
    Feb 18 18:40:07 ispconfig systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory
    Feb 18 18:40:07 ispconfig apache2[3011]: Starting web server: apache2AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-ispconfig.conf:62
    Feb 18 18:40:09 ispconfig apache2[3011]: .
    Feb 18 18:40:09 ispconfig systemd[1]: Started LSB: Apache2 web server.

    but wen i do
    ps aux | grep php- is see this:
    root@ispconfig:~# ps aux | grep php-
    root 442 0.0 0.0 151156 148 ? Ss 18:10 0:00 php-fpm: master process (/opt/php-5.5.32/etc/php-fpm.conf)
    root 443 0.0 0.0 283540 128 ? Ss 18:10 0:00 php-fpm: master process (/opt/php-5.4.45/etc/php-fpm.conf)
    www-data 446 0.0 0.0 283540 8 ? S 18:10 0:00 php-fpm: pool www
    www-data 447 0.0 0.0 283540 8 ? S 18:10 0:00 php-fpm: pool www
    www-data 450 0.0 0.0 151112 8 ? S 18:10 0:00 php-fpm: pool www
    www-data 451 0.0 0.0 151112 8 ? S 18:10 0:00 php-fpm: pool www
    web1 452 0.0 0.9 151196 3916 ? S 18:10 0:00 php-fpm: pool web1
    web1 453 0.0 0.8 151196 3716 ? S 18:10 0:00 php-fpm: pool web1
    root 561 0.0 0.0 363436 144 ? Ss 18:10 0:00 php-fpm: master process (/opt/php-5.3.29/etc/php-fpm.conf)
    www-data 568 0.0 0.0 363436 16 ? S 18:10 0:00 php-fpm: pool www
    www-data 569 0.0 0.0 363436 16 ? S 18:10 0:00 php-fpm: pool www
    root 740 0.0 0.0 528896 328 ? Ss 18:10 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
    www-data 842 0.0 0.0 528896 16 ? S 18:10 0:00 php-fpm: pool www
    www-data 843 0.0 0.0 528896 16 ? S 18:10 0:00 php-fpm: pool www
    root 3130 0.0 0.2 12632 1088 pts/0 S+ 18:43 0:00 grep php-

    and wen i do netstat -a4
    root@ispconfig:~# netstat -a4
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 localhost.localdo:10025 *:* LISTEN
    tcp 0 0 *:2025 *:* LISTEN
    tcp 0 0 *:mysql *:* LISTEN
    tcp 0 0 *:submission *:* LISTEN
    tcp 0 0 localhost.localdo:11211 *:* LISTEN
    tcp 0 0 *:http-alt *:* LISTEN
    tcp 0 0 *:http *:* LISTEN
    tcp 0 0 *:tproxy *:* LISTEN
    tcp 0 0 *:urd *:* LISTEN
    tcp 0 0 *:ftp *:* LISTEN
    tcp 0 0 *:ssh *:* LISTEN
    tcp 0 0 *:smtp *:* LISTEN
    tcp 0 0 *:https *:* LISTEN
    tcp 0 0 localhost.localdom:8997 *:* LISTEN
    tcp 0 0 localhost.localdom:8998 *:* LISTEN
    tcp 0 0 localhost.localdom:8999 *:* LISTEN
    tcp 0 0 localhost.localdo:10024 *:* LISTEN
    tcp 0 64 ispconfig.xxxxx.n:ssh coomas1.xxxxx.ne:3886 ESTABLISHED
    tcp 0 0 ispconfig.xxxxx.n:ssh coomas1.xxxxx.ne:3894 ESTABLISHED
    tcp 0 0 ispconfig.xxxxx.n:ssh coomas1.xxxxx.ne:3758 ESTABLISHED
    udp 0 0 localhost.localdo:11211 *:*

    To me it looks like php 5.3, 5.4, 5.5 fpm are all running but syslog says they are not running.
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

  5. Guido64

    Guido64 Member

    Yes that is what I did.
    Great, thank you for pointing me in the right direction.
    I will let you know if that fixed things but I'm pretty sure that's it.
     
  6. Guido64

    Guido64 Member

    I changed things like in the php7 tutorial but no luck it doesn't want to work.
    This is what is in the syslog maybe it tells you something what might going on.

    Feb 18 22:43:04 ispconfig systemd[1]: Reloading LSB: starts php-5.3.29-fpm.
    Feb 18 22:43:04 ispconfig php-5.3.29-fpm[1777]: Reload service php-fpm done
    Feb 18 22:43:04 ispconfig systemd[1]: Reloaded LSB: starts php-5.3.29-fpm.
    Feb 18 22:43:05 ispconfig systemd[1]: Reloading LSB: starts php-5.5.32-fpm.
    Feb 18 22:43:05 ispconfig php-5.5.32-fpm[1786]: Reload service php-fpm done
    Feb 18 22:43:05 ispconfig systemd[1]: Reloaded LSB: starts php-5.5.32-fpm.
    Feb 18 22:43:05 ispconfig systemd[1]: Stopping LSB: Apache2 web server...
    Feb 18 22:43:07 ispconfig apache2[1795]: Stopping web server: apache2.
    Feb 18 22:43:07 ispconfig systemd[1]: Starting LSB: Apache2 web server...
    Feb 18 22:43:07 ispconfig systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory
    Feb 18 22:43:07 ispconfig apache2[1824]: Starting web server: apache2AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-ispconfig.conf:62
     
  7. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    well I won't say "without luck" looks good for the reloading php-fpm part ( no service can't be reloaded anymore ).

    I don't know what's wrong with your apache but a quick google pointed me to many recent bug posts. Some say there's uncleaned memory thus reloading apache doesn't work but restart with a few seconds in between ( issue would happen after running logrotate for some ppl ).

    What I also found was something more close to what you're doing - interesting thing it's the same solution as for someone else having bind9 not starting at system boot but working nicely when starting by hand:
    https://www.upcloud.com/support/apache2-problems-on-cloud-server/
    It recommends to reinstall apache2 package ( first remove and then install again )
     
  8. Guido64

    Guido64 Member

    Thank you again I searched google up and down with those errors I found in syslog but I didn't found what you found.
    Not that you think i'm not searching because I do always befor I ask for help her.

    I removed Apache2 en reinstalled the package and rebooted. Now ispconfig doesn't work anymore at all and the test site doesn't work anymore either.

    Good thing I have a backup of the clean ispconfig vps without all the php versions so I will start all over again tomorrow and let you know here how it went. Fingers crossed.
     
  9. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    weird - did you purge remove apache? and no didn't mean to say you're lazy, just mentioned it was not based on some knowledge I have.
    Since it's a rather unusual issue I hope it won't happen again.
     
    Guido64 likes this.
  10. Guido64

    Guido64 Member

    yeah I did add --purge wen I removed apache, maybe I shouldn't have done that. Anyway the vps is destroyed and the vps is restored from the backup and ready to try again tomorrow or the day after wen I have the time. Hopefully more luck then.
     
  11. Guido64

    Guido64 Member

    Tonight i installed additional php 7 to my debian 8 ispconfig 3 vps. Everything went well so i thought. After i configured everything as in the tutorial. I setup a test domain and a test website which works as it should with the default php. Then i switched to php 7.0.3 wen i reloaded the php script with phpinfo() function it showed a error 500 page.

    befor i switched to php 7 i opened 3x putty i tailed syslog and watch "ps aux | grep php" and /var/log/ispconfig/httpd/testdomain.org/error.log but nothing happenned no error of anything i could see happening. Only thing what happened was with putty were i watched ps aux | grep php there web1 disapeared while it should have switched to the other php-fpm 7.0.3 but it didn't it just disapperead.

    Then i switched back to the default php version that worked the page works again with the default php version.

    Switching back and fort between default and php-cgi 7.0.3 works.

    Kind of the same behavior as yesterday.
     
    Last edited: Feb 20, 2016
  12. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    I did some testing for myself now and can confirm there are some issues when switching php-fpm versions.
    Seems the issue is related to the order in which services gets reloaded/restartet. I guess there's a need for some patches to ISPConfig.

    Unfortunally I don't have time to dig further right now but I'll try to check on that later.
     
    Last edited: Feb 20, 2016
  13. Guido64

    Guido64 Member

    Thank you for letting know and confirming its not working right.
    Hopefully it can be solved. Its way above my knowledge I am afraid.
     
  14. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    While in theory everything is issued in the right order when switching php versions,
    Code:
    21.02.2016-21:05 - DEBUG - Found 1 changes, starting update process.
    21.02.2016-21:05 - DEBUG - Calling function 'ssl' from plugin 'apache2_plugin' raised by event 'web_domain_update'.
    21.02.2016-21:05 - DEBUG - Calling function 'update' from plugin 'apache2_plugin' raised by event 'web_domain_update'.
    21.02.2016-21:05 - DEBUG - Enable SSL for: domain
    21.02.2016-21:05 - DEBUG - Writing the vhost file: /etc/apache2/sites-available/domain.vhost
    21.02.2016-21:05 - DEBUG - Writing the PHP-FPM config file: /etc/php5/fpm/pool.d/web1.conf
    21.02.2016-21:05 - DEBUG - Removed PHP-FPM config file: /opt/php-7.0.3/etc/php-fpm.d/web1.conf
    21.02.2016-21:05 - DEBUG - Calling function 'restartPHP_FPM' from module 'web_module'.
    21.02.2016-21:05 - DEBUG - Restarting php-fpm: systemctl reload php-7.0.3-fpm.service
    21.02.2016-21:05 - DEBUG - Calling function 'restartPHP_FPM' from module 'web_module'.
    21.02.2016-21:05 - DEBUG - Restarting php-fpm: systemctl reload php5-fpm.service
    21.02.2016-21:05 - DEBUG - Apache status is: running
    21.02.2016-21:05 - DEBUG - Calling function 'restartHttpd' from module 'web_module'.
    21.02.2016-21:05 - DEBUG - Restarting httpd: systemctl restart apache2.service
    21.02.2016-21:05 - DEBUG - Apache restart return value is: 0
    21.02.2016-21:05 - DEBUG - Apache online status after restart is: running
    21.02.2016-21:05 - DEBUG - Processed datalog_id 141
    21.02.2016-21:05 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    
    However the reload/restart procedure sometimes fails leaving one or the other php version in "stopped" state. If that happens apache also does not reload the config.
    After restarting php5,7 and apache several times I was able to switch between PHP versions without error.

    Since I'm new to systemd and there are no useable log infos on why reload failes I still need some time to play with that. Just wanted to give you a small update.
     
  15. Guido64

    Guido64 Member

    Thank you for the update.

    I tried what you wrote to restart php 5 & 7 and Apache several times. For me no luck. I restarted php 5 & 7 and Apache several times with service restart and also restarted via the init scripts but no luck it does not want to switch to php7. Even wen I restart the vps still no php7-fpm. Wen I switch back to the default php5-fpm that works right away.

    The strange thing is that the static html default page does not work either wen i switch to php7. Normaly i would expect the phpinfo script would not work but a simple static html should work so i think there is more going on then php7 only the web1 doesn't run. Wen i watch ps aux | grep php i see web1 disappear wen i switch to php7-fpm and coming back wen i switch to default php5-fpm.
     
    Last edited: Feb 22, 2016
  16. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

  17. Guido64

    Guido64 Member

    Great there is a solution. The only thing is i don´t understand it completly. One thing i don´t understand is the answer on your question what exactly to put in the init script path. I changed it too php-7.0.3-fpm.

    Then I deleted the init scripts php-7.0.3-fpm and php5-fpm and remove the boot links with update-rc.d. After a reboot php5-fpm works but switching to php7-fpm still no joy.

    Could you please explain what i exactly have to do to make it work?

    Thanks btw for the update / link to the other thread about this.
     
    Last edited: Feb 23, 2016
  18. borekon

    borekon New Member

    Hi, i prefer to write here instead open a new thread. I followed this tutorial
    Not working for me. I select the php version in the domain tab and click save. Then, open a phpinfo page that shows i'm using the default version of PHP instead the installed one.
     
  19. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Since I am on Debian 8 and systemd is the supported way to go I first made sure the initd-script is disabled
    Code:
    insserv -r php-7.0.3-fpm
    Then made sure the systemd script is enabled
    Code:
    systemctl enable php-7.0.3-fpm.service
    Within ISPConfig at Additional PHP-Version "Path to the PHP-FPM init script" expects the name of the systemd .service file, which in my case is php-7.0.3-fpm.service - but without .service extension. So the "Path to init script" is: php-7.0.3-fpm

    Works like a charm, did some rebooting and switching - all fine, no 503.

    borekon
    Are you on Debian 7? What do you see when setting System > Server Config > Loglevel to "Debug" and run /usr/local/ispconfig/server/server.sh on terminal right after switching PHP version?
    Are you using FPM or FastCGI method? Which Apache modules are installed and enabled? ( type a2dismod, press tab two times and you get a list, if not make use of . /etc/bash_completion if installed )
     
    Last edited: Feb 24, 2016
    Guido64 and borekon like this.
  20. borekon

    borekon New Member

    Thanks for quick answer. I'm using Debian 7.
    When type server.sh:
    When type a2dismod:
    I'm using the FPM method.

    Thanks in advance
     
    Last edited: Feb 24, 2016

Share This Page