英文:
two versions of PHP on the same Ubuntu 18.04 server with Apache
问题
以下是翻译好的内容:
我有一台安装了Ubuntu 18.04的服务器,其中托管了两个应用程序,一个使用PHP 7.0,另一个使用PHP 8.0。我按照几份详细说明了PHP-FPM的指南进行了操作,所有步骤都正确执行,没有报错,但在浏览器中检查时,两者都显示版本8.0。你能帮我解决这个问题吗?
英文:
I have a server with Ubuntu 18.04 on which I host two applications, one works with PHP 7.0 and the other with PHP 8.0. I have followed several guides where they explain in detail what to do with PHP-FPM and I do all the steps correctly without throwing errors but when checking in the browser it shows me version 8.0 for both. Could you help me with this?” Is there anything else you would like to know?
these are the virtual hosts
<VirtualHost *80:>
ServerName certificacion.local
DocumentRoot /var/www/certificacion.local
<Directory /var/www/certificacion.local>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php7.0-fpm.sock|fcgi://localhost/var/www/certificacion.local"
ErrorLog ${APACHE_LOG_DIR}/certificacion.local-error.log
CustomLog ${APACHE_LOG_DIR}/certificacion.local-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName fiscalizacion.local
DocumentRoot /var/www/fiscalizacion.local
<Directory /var/www/fiscalizacion.local>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php8.0-fpm.sock|fcgi://localhost/var/www/fiscalizacion.local"
ErrorLog ${APACHE_LOG_DIR}/fiscalizacion.local-error.log
CustomLog ${APACHE_LOG_DIR}/fiscalizacion.local-access.log combined
</VirtualHost>`
i tried to configure PHP-FPM
答案1
得分: 2
这是它对我有效的方式
<VirtualHost *:80>
DocumentRoot "/var/www/qa-laravel/public"
ServerName .....local
<Directory "/var/www/qa-laravel/public">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhos
</FilesMatch>
</VirtualHost>
检查 PHP-FPM 服务:确认两个 PHP 版本的 PHP-FPM 服务正常运行。
service php7.0-fpm status
service php8.0-fpm status
英文:
That's how it works for me
<VirtualHost *:80>
DocumentRoot "/var/www/qa-laravel/public"
ServerName .....local
<Directory "/var/www/qa-laravel/public">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhos>
</FilesMatch>
</VirtualHost>
Check PHP-FPM service: Confirm that the PHP-FPM services for both PHP versions are running properly.
service php7.0-fpm status
service php8.0-fpm status
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论