Secondary php for nginx
Secondary php for nginx
Hello everyone!
In my centos 7 i have running project "RadiusDesk", which work with php5.4.16
Now i wont to upload laravel project to this server which requires php>5.6.4
Is it a way to install second php version and keep running my old project?
Before writing here i read many topics and tried many examples in my VM but without success
Any recomendation for how to do it?
Thanks!
In my centos 7 i have running project "RadiusDesk", which work with php5.4.16
Now i wont to upload laravel project to this server which requires php>5.6.4
Is it a way to install second php version and keep running my old project?
Before writing here i read many topics and tried many examples in my VM but without success
Any recomendation for how to do it?
Thanks!
Re: Secondary php for nginx
Sounds like exactly what SCLs are designed for - parallel installation of multiple copies of php. You'll need to use php-fpm for nginx in any case. Use yum install centos-release-scl to add the SCL repos then use yum list \*php\* to see all the possibles (there'll be lots, might want to pipe that into a pager).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Secondary php for nginx
2 tips
1/ you need to change the listen port for the second FPM instance (e.g. listen directive in /etc/opt/rh/rh-php56/php-fpm.d/www.conf
2/ you have to set port SElinux mode to allow connection (only default port 9000 is allowed)
# semanage port -a -t http_port_t -p tcp 9056
Or, only use Unix Domain Socket.
1/ you need to change the listen port for the second FPM instance (e.g. listen directive in /etc/opt/rh/rh-php56/php-fpm.d/www.conf
2/ you have to set port SElinux mode to allow connection (only default port 9000 is allowed)
# semanage port -a -t http_port_t -p tcp 9056
Or, only use Unix Domain Socket.
Re: Secondary php for nginx
i installed rh-php70 using scl. What is next?
can anyone write more detail about how to do it.
i tried to switch to php70 but without success
in /etc/opt/rh/rh-php56/ doesnt exist php-fpm.d folder
i installed php70 with this command
yum install rh-php70 rh-php70-php-fpm rh-php70-php-cli
can anyone write more detail about how to do it.
i tried to switch to php70 but without success
in /etc/opt/rh/rh-php56/ doesnt exist php-fpm.d folder
i installed php70 with this command
yum install rh-php70 rh-php70-php-fpm rh-php70-php-cli
Re: Secondary php for nginx
> in /etc/opt/rh/rh-php56/ doesnt exist php-fpm.d folder
Of course... if you install rh-php70-php-fpm..... /etc/opt/rh/rh-php70/
Of course... if you install rh-php70-php-fpm..... /etc/opt/rh/rh-php70/
Re: Secondary php for nginx
Sorry, i wrote with error
/etc/opt/rh/rh-php70/ in this path php-fpm.d folder doesn't exist and file www.conf too
can anyone write more details about how to do it
/etc/opt/rh/rh-php70/ in this path php-fpm.d folder doesn't exist and file www.conf too
can anyone write more details about how to do it
Re: Secondary php for nginx
Check you have installed the package...
Code: Select all
# rpm -q --configfiles rh-php70-php-fpm
/etc/logrotate.d/rh-php70-php-fpm
/etc/opt/rh/rh-php70/php-fpm.conf
/etc/opt/rh/rh-php70/php-fpm.d/www.conf
/etc/opt/rh/rh-php70/sysconfig/php-fpm
Re: Secondary php for nginx
Thanks for reply! remirepo!
I checked with your command and result was like as yours.
Next step a must to create virtualhosts?
I googled posts for this problem end finded some info like
https://www.sitepoint.com/run-multiple- ... ne-server/]
in this post two projects configured in nginx.conf
second way is to create 2 virtualhost? if this is the right way: how in virtualhost show the needed php version
I checked with your command and result was like as yours.
Next step a must to create virtualhosts?
I googled posts for this problem end finded some info like
https://www.sitepoint.com/run-multiple- ... ne-server/]
in this post two projects configured in nginx.conf
second way is to create 2 virtualhost? if this is the right way: how in virtualhost show the needed php version
Re: Secondary php for nginx
I'm not a nginx experrt, but you simply have to use the right fastcgi_pass directive in each vhost configuration, to be able to choose the PHP version used by this vhost.
P.S. can probably be done per directory / project, not requiring vhost (at least this is possible with Apache httpd)
Code: Select all
fastcgi_pass 127.0.0.1:90##;
P.S. can probably be done per directory / project, not requiring vhost (at least this is possible with Apache httpd)
Re: Secondary php for nginx
Now i went one step further. now i have two php versions and two running php fpm. Now i need to handle requests to right php version
my nginx.conf look like this:
my rh-php70-php-fpm listens
listen 127.0.0.1:9002
But when i trying to open test file in php4 and php7 folders phpinfo() shows me identical version 5.4.16
what's wrong in my settings?
my nginx.conf look like this:
Code: Select all
server {
listen 80;
server_name php4.localhost;
root /usr/share/nginx/html/php4;
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name php7.localhost;
root /usr/share/nginx/html/php7;
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
listen 127.0.0.1:9002
But when i trying to open test file in php4 and php7 folders phpinfo() shows me identical version 5.4.16
what's wrong in my settings?