Answer the question
In order to leave comments, you need to log in
How to tell apache which version of php to use?
OS Freebsd
Installed the second version of php 70 on the server, but now I can't find where to tell apache which version of PHP to use.
And another question, how can I specify a specific version of php for a separate host?
Answer the question
In order to leave comments, you need to log in
sudo a2dismod php5.6 // отключаем старую версию пыхи в апаче
sudo a2enmod php7.1 // включаем новую версию пыхи в апаче
sudo update-alternatives --set php /usr/bin/php7.1 // выставляем версию cli
sudo service apache2 restart
For Nginx
cd /etc/nginx/sites-available/
sudo nano your_domain.com
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; # какую версию читать для сайта your_domain.com выбрать можно любую с установленых на серваке
}
sudo apt install php7.2 php7.2-fpm # установили php версию нужную для определенного домена
###
sudo a2enmod actions fastcgi alias proxy_fcgi # Ubuntu старее 18.04
sudo a2enmod actions fcgid alias proxy_fcgi # Ubuntu 18.04
###
sudo nano /etc/apache2/sites-available/your_domain.com
<VirtualHost *:80>
ServerName your_domain.com
DocumentRoot /var/www/your_domain_folder
<Directory /var/www/your_domain_folder>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/" # версия php которая нужна на этом домене
</FilesMatch>
</VirtualHost>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question