CentOS 7 multiple version of PHP

Discussion in 'Installation/Configuration' started by Niubbo75, Feb 28, 2016.

  1. Niubbo75

    Niubbo75 Member

    Hello to all.
    I have a CentOS 7 x86_64 server running with PHP 5.4.x used for webserver (with ISPConfig 3, apache and MySQL configured use the perfect server tutorial). I need to have also PHP 5.6.x and PHP 7 and the possibility to choose what to use in ISPConfig panel.
    I have try to search a tutorial or something like that both here and on Google, but unfotunately I have not find what I need.
    Can someone tell me how to do that or link to a guide where I can find my way?
    Thanks in advance.
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

  3. Niubbo75

    Niubbo75 Member

    Hello ztk.me and thanks for your hint.
    I have follow that tutorials but seems something don't work well on my CentOS 7.

    After installed php 5.6.18 and added it to ISPCOnfig 3, when I enable it with PHP-FPM on the desired website I got a 503 while I'm try to open it in a browser, other websites on the same server with default php 5.4 works great, same if I enable FAST-CGI, works great.
    Only with PHP-FPM doesn't work, any idea on how to solve the problem?

    P.S.: now I try the same way with PHP 7, I'll keep you informed on how it goes.
     
  4. m4l41k4t

    m4l41k4t Member

    if it running well in Centos 7, please shared info, I am also working on this
     
  5. Niubbo75

    Niubbo75 Member

    @m4l41k4t seems it doesn't run on CentOS 7, I'm working on that and I'll keep informed if/when I got the goal.
     
  6. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Centos 7 is using systemd - don't mix init scripts and systemd init files - also just add the systemd file to your init script path in ISPConfig, without the .extension.

    Did you check wether you have proxy fcgi module enabled? It can cause bugs on Centos.
    Also did you check wether you enabled Sockets or TCP for communication to PHP-FPM on the website you're testing on?
     
  7. Niubbo75

    Niubbo75 Member

    No way! :( If I use the default php version I have installed there (5.4.x) all works in any way (CGI FastCGI FPM) but when i switch to 5.6.18 it works only in FastCGI, if I try FPM I alway get a 503 (and I'm trying using a simple phpinfo() just to let me know what PHP is running).

    I have made a systemd init file (it's the first time I do this, maybe is not syntax correct, please give a look):

    Code:
    [Unit]
    Description=The PHP 5.6.18 FastCGI Process Manager
    After=syslog.target network.target
    
    [Service]
    Type=notify
    PIDFile=/run/php-fpm/php-fpm.pid
    EnvironmentFile=/etc/sysconfig/php-fpm
    ExecStart=/opt/php-5.6.18/sbin/php-fpm --nodaemonize
    ExecReload=/bin/kill -USR2 $MAINPID
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target
    I have put this script into /usr/lib/systemd/system and also into /etc/systemd/system/multi-user.target.wants
    Where I'm wrong?
     
  8. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Code:
    [Unit]
    Description=The PHP 7.0.4 FastCGI Process Manager
    After=network.target
    
    [Service]
    Type=simple
    PIDFile=/opt/php-7.0.4/var/run/php-fpm.pid
    ExecStart=/opt/php-7.0.4/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.0.4/etc/php-fpm.conf
    ExecReload=/bin/kill -USR2 $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    
    Is working fine for me ( PHP7 on Centos 7 ), most likely it's because of the --fpm-config /opt/php-7.0.4/etc/php-fpm.conf part.

    Did you enable the default www-pool? What does
    Code:
    systemctl status php-7.0.4-fpm.service
    
    tell you?
     
  9. Niubbo75

    Niubbo75 Member

    Code:
    [root@solinfsrv01 ~]# systemctl status php5.6.18-fpm.service -l
    â php5.6.18-fpm.service - The PHP 5.6.18 FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php5.6.18-fpm.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since mer 2016-03-23 15:00:56 CET; 2min 35s ago
       Process: 1033 ExecStart=/opt/php-5.6.18/sbin/php-fpm --nodaemonize (code=exited, status=78)
       Main PID: 1033 (code=exited, status=78)
    mar 23 15:00:29 solinfsrv01.soluzioni-informatiche.org systemd[1]: Starting The PHP 5.6.18 FastCGI Process Manager...
    mar 23 15:00:30 solinfsrv01.soluzioni-informatiche.org php-fpm[1033]: Failed loading /opt/php-5.6.18/lib/php/extension/no-debug-non-zts-20131226/ioncube.so:  /opt/php-5.6.18/lib/php/extension/no-debug-non-zts-20131226/ioncube.so: cannot open shared object file: No such file or directory
    mar 23 15:00:30 solinfsrv01.soluzioni-informatiche.org php-fpm[1033]: [23-Mar-2016 15:00:30] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/php-5.6.18/lib/php/extensions/no-debug-non-zts-20131226/apc.so' - /opt/php-5.6.18/lib/php/extensions/no-debug-non-zts-20131226/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org php-fpm[1033]: [23-Mar-2016 15:00:56] ERROR: unable to bind listening socket for address '127.0.0.1:8999': Address already in use (98)
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org php-fpm[1033]: [23-Mar-2016 15:00:56] ERROR: FPM initialization failed
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org systemd[1]: php5.6.18-fpm.service: main process exited, code=exited, status=78/n/a
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org systemd[1]: Failed to start The PHP 5.6.18 FastCGI Process Manager.
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org systemd[1]: Unit php5.6.18-fpm.service entered failed state.
    mar 23 15:00:56 solinfsrv01.soluzioni-informatiche.org systemd[1]: php5.6.18-fpm.service failed.
    
    I have compiled PHP 5.6.18 following the tutorial you had linked before using last release of PHP instead of 5.3.x and still having thi troubles :(
     
  10. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    You need to make sure you assign a not used port to the default www-pool!
    kill all running instances of your php 5.6-fpm
    make sure you either use init.d or systemd, systemd is perferred.
    Check the listen-setting and then start it either using init or systemd
    also you did not build apc/u for php 5.6 whichever you want to use ( no need for apc if you use zend opcode cacher for instance ).
    Also ioncube.so is not in the right place ... did you set this up for the new old php version already or is it parsing some existing .ini files?
     
  11. Niubbo75

    Niubbo75 Member

    Done, there are no process of php-5.6.18 running on the system, delete also in chkconfig but if i run systemctl start php5.6.18.service it go in timeout
    I need to check path because I have build also apc and ioncube, ioncube is into php-5.6.18 php.ini I just to check path, maybe I have write something wrong.
     
  12. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Ok and after changing the default listening port in your www fpm-config section, what does
    Code:
    systemctl status php5.6.18-fpm.service -l
    say now? It should be able to bind now at least.

    Does executing this php versions cli program show any issues?
     
  13. Niubbo75

    Niubbo75 Member

    Still go in timeout and so it fail to load, exiting with kill but I have not have the time to check and fix apc & ioncube paths, maybe the problem is there.
     

Share This Page