Instalar PHP 5.6 como adicional PHP-FPM & FastCgi para ISPconfig en Ubuntu 16.04 馃惂
Aunque lo ideal es que trabajemos con php7 aun hay scripts en php5 que por algunas razones debemos instalar, y este un excelente metodo para poder migrar de php5 a php7, imaginemosnos que podemos swichar de una version a otra en 1 minutos y ver las diferencias.
1.- Configurar dependencias
4.- copiamos php.ini y php-fpm.conf en la correcta ubicaci贸n.
Creamos el archivo pool de php-fpm.d.
5.- Creasmo el archivo init
Esto es para que la anterior configuracion funcione incliso despes de reiniciar el servidor.
Creamos el archivo "/lib/systemd/system/php-5.6.30-fpm.service" asi:
Abilitamos el servicio al reiniciar el server.
inicializamos PHP-FPM
Habilitamos opcache editando el archivo "/opt/php-5.6.30/lib/php.ini" asi
Testeamos la version de php

6.- Habilitamos PHP5.6 en ISPConfig.
En ISPConfig 3.1, se puede configurar la nueva versi贸n de PHP en "Sistema> Versiones PHP adicionales". En la pesta帽a Nombre, solo debe completar un nombre para la versi贸n de PHP (por ejemplo, PHP 5.6.30): esta versi贸n de PHP se mostrar谩 debajo de este nombre en la configuraci贸n del sitio web en ISPConfig:

Vaya a la pesta帽a Configuraci贸n de FastCGI y complete los campos de la siguiente manera:
Path to the PHP FastCGI binary: /opt/php-5.6.30/bin/php-cgi
Path to the php.ini directory: /opt/php-5.6.30/lib

A continuaci贸n, vaya a la pesta帽a Configuraci贸n de PHP-FPM y complete los campos de la siguiente manera:

OPCIONAL INSTALAR XDBUG
1.- Configurar dependencias
apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-dev
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
2.- Descargar y extraer PHP 5.6 desde php.netmkdir /opt/php-5.6.30
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de.php.net/get/php-5.6.30.tar.bz2/from/this/mirror -O php-5.6.30.tar.bz2
tar jxf php-5.6.30.tar.bz2
cd php-5.6.30/
3.- Prepara archivo de configuraci贸n../configure --prefix=/opt/php-5.6.30 --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-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-gettext --with-xmlrpc --with-xsl --with-kerberos --enable-fpm
Si miramos al fina la instruccion --enable-fpm forza a que trabajemos con fpmmake
make install
4.- copiamos php.ini y php-fpm.conf en la correcta ubicaci贸n.
cp /usr/local/src/php5-build/php-5.6.30/php.ini-production /opt/php-5.6.30/lib/php.ini
cp /opt/php-5.6.30/etc/php-fpm.conf.default /opt/php-5.6.30/etc/php-fpm.conf
Creamos el archivo pool de php-fpm.d.
mkdir /opt/php-5.6.30/etc/php-fpm.d
Abrimos "/opt/php-5.6.30/etc/php-fpm.conf" asi:vim /opt/php-5.6.30/etc/php-fpm.conf
Buscamos y editamos las siguientes lineas para que nuestro archivo quede asi:[...]
pid = run/php-fpm.pid
[...]
user = www-data
group = www-data
[...]
listen = 127.0.0.1:8999
[...]
include=/opt/php-5.6.30/etc/php-fpm.d/*.conf
5.- Creasmo el archivo init
Esto es para que la anterior configuracion funcione incliso despes de reiniciar el servidor.
Creamos el archivo "/lib/systemd/system/php-5.6.30-fpm.service" asi:
vim /lib/systemd/system/php-5.6.30-fpm.service
donde colocamos esto:[Unit]
Description=The PHP 5.6 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php-5.6.30/var/run/php-fpm.pid
ExecStart=/opt/php-5.6.30/sbin/php-fpm --nodaemonize --fpm-config /opt/php-5.6.30/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
Abilitamos el servicio al reiniciar el server.
systemctl enable php-5.6.30-fpm.service
systemctl daemon-reload
systemctl start php-5.6.30-fpm.service
Habilitamos opcache editando el archivo "/opt/php-5.6.30/lib/php.ini" asi
vim /opt/php-5.6.30/lib/php.ini
Agregamos esto al final:[...]
zend_extension=opcache.so
cd /opt/php-5.6.30/bin
./php --version

6.- Habilitamos PHP5.6 en ISPConfig.
En ISPConfig 3.1, se puede configurar la nueva versi贸n de PHP en "Sistema> Versiones PHP adicionales". En la pesta帽a Nombre, solo debe completar un nombre para la versi贸n de PHP (por ejemplo, PHP 5.6.30): esta versi贸n de PHP se mostrar谩 debajo de este nombre en la configuraci贸n del sitio web en ISPConfig:

Vaya a la pesta帽a Configuraci贸n de FastCGI y complete los campos de la siguiente manera:
Path to the PHP FastCGI binary: /opt/php-5.6.30/bin/php-cgi
Path to the php.ini directory: /opt/php-5.6.30/lib

A continuaci贸n, vaya a la pesta帽a Configuraci贸n de PHP-FPM y complete los campos de la siguiente manera:
Path to the PHP-FPM init script: php-5.6.30-fpm
Path to the php.ini directory: /opt/php-5.6.30/lib
Path to the PHP-FPM pool directory: /opt/php-5.6.30/etc/php-fpm.d

OPCIONAL INSTALAR XDBUG
cd /tmp/ mkdir xdebug cd xdebug/ wget https://pecl.php.net/get/xdebug-2.5.5.tgz tar xf xdebug-2.5.5.tgz cd xdebug-2.5.5 /opt/php-5.6.30/bin/phpize ./configure --with-php-config=/opt/php-5.6.30/bin/php-config make make install
Editar php.ini
vim /opt/php-5.6.30/lib/php.ini
Agregar esta linea
zend_extension=/opt/php-5.6.30/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
Comentarios
Publicar un comentario