skip to Main Content

I was trying to upgrade php 5.4 to 7 on my CentOS 7 using this toutorial:
https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-centos-7

And I made this:

sudo yum remove php-cli mod_php php-common
[erased everything – done]
sudo yum install mod_php70u php70u-cli php70u-mysqlnd 

“nothing to do”

All my websites are: 502 Bad Gateway / nginx

In Plesk I see this:

New configuration files for the Apache web server were not created due to the errors in configuration templates:
[Sun Jul 10 20:52:21.734150 2016] [so:warn] [pid 11833] AH01574: module actions_module is already loaded, skipping

[Sun Jul 10 20:52:21.735241 2016] [so:warn] [pid 11833] AH01574: module headers_module is already loaded, skipping [Sun Jul 10 20:52:21.735398 2016] [so:warn] [pid 11833] AH01574: module logio_module is already loaded, skipping
[Sun Jul 10 20:52:21.735945 2016] [so:warn] [pid 11833] AH01574: module suexec_module is already loaded, skipping AH00526: Syntax error on line 33 of /etc/httpd/conf/plesk.conf.d/roundcube.conf: Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory . Detailed error descriptions were sent to you by email. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files. See the details in Configuration Troubleshooter

Please help.

2

Answers


  1. If you are using NGINX. as web server this works. instructions to apache are very similar. the part that changes is the last part.

    I had to set up servers with NGINX/APACHE that support and array of PHP versions (from 5.3 to php7).

    the server that we currently use is NGINX (has better performance and lower memory footprint)

    In order to have multiple versions I compile PHP from the source and make listen the php process in a 127.0.0.1:port

    ex: fastcgi_pass   127.0.0.1:9053; (php53)
        fastcgi_pass   127.0.0.1:9054; (php54)
        fastcgi_pass   127.0.0.1:9055; (php55)
        fastcgi_pass   127.0.0.1:9056; (php56)
        fastcgi_pass   127.0.0.1:9070; (php57)
    

    you will need to install all depedencies in order to compile PHP from source:

    yum update -y
    yum install epel-release -y    
    yum update -y    
    yum group install "Development Tools" -y
    
    yum install wget curl nano libmcrypt-devel bzip2-devel curl-devel db4-devel libjpeg-devel libpng-devel libXpm-devel gmp-devel libc-client-devel openldap-devel unixODBC-devel postgresql-devel sqlite-devel net-snmp-devel libxslt-devel pcre-devel mysql-devel postgresql-devel libxslt-devel mariadb-client freetype-devel.x86_64 libxml2-devel -y
    
    yum install httpd php php-xml php-mbstring php-mcrypt php-pdo -y 
    
    yum install php-devel php-pear mysql-devel httpd-devel -y
    

    Then you will need to download the desired php version.
    Dowload PHP7 into the /opt/ folder of the server.

    http://php.net/get/php-7.0.8.tar.gz/from/a/mirror

    (In the server, I prefer to download and compile PHP in the /opt/ folder.)

    cd /opt/
    

    Extract the source:

    tar xzvf php-7.0.*.tar.gz (the version you download)
    

    cd into the php folder:

    cd php-7.0.8/
    

    Configure php.

    ./configure --prefix=/opt/php7 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex  --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=apache --with-fpm-group=apache --with-libdir=lib64     --enable-ftp --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm
    

    then:

     make && make install
        cd sapi/fpm
        #create start/stop php-php script
        cp init.d.php-fpm /etc/init.d/php7
        #give perms
        chmod 775 /etc/init.d/php7
        #move php-fpm configuration file to right location
        mv /opt/php7/etc/php-fpm.conf.default /opt/php7/etc/php-fpm.conf 
        mv /opt/php7/etc/php-fpm.d/www.conf.default /opt/php7/etc/php-fpm.d/www.conf
        #configure php-fpm to listen to 9070 port
        sed -i 's/^listen =.*/listen = 127.0.0.1:9070/' /opt/php7/etc/php-fpm.d/www.conf
       #copy php.ini file to right location
        cp /opt/php-7.0.8/php.ini-production /opt/php7/lib/php.ini
        #Give perms
        chmod 777 /opt/php7/lib/php.ini    
        # start PHP7 automatically
        chkconfig --add php7
        chkconfig --level 345 php7 on
    

    Then create the NGINX configuration file.

    server {
        listen  80;
    
        server_name test.com www.test.com;
    
        location / {
            root  /var/www/html/7;
            index  index.php index.html index.htm;
            try_files $uri $uri/ =404;
        }       
    
         location ~ .php$ {
                root           /var/www/html/7;
                fastcgi_pass   127.0.0.1:9070;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
    
    
    
    }
    

    Finally:

    service nginx stop
    service nginx start
    

    And you are ready to go…
    hope this helps.
    Detailed info: https://github.com/dferrans/Centos-7-nginx-stack-multiple-php

    Login or Signup to reply.
  2. Have you already install all the RPMs? If so, try this:

    yum install php70u php70u-fpm php70u-fpm-nginx php70u-mbstring php70u-json -y
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search