This article brings you relevant knowledge about PHP. It mainly talks about how to configure multiple versions of PHP for Nginx and Apache, and how to cut multiple conf files. Interested friends will take a look below. Let's take a look, hope it helps everyone.
Sometimes our projects cannot all have the same PHP version, and each project needs to be configured with a different version of PHP. Pagoda and PHPStudy are implemented through the following configuration:
Nginx
Cut conf (unselected)
Add
include vhosts/*.conf;
Configuring multiple versions of PHP
Addserver { listen 80; server_name localhost; root "D:/WWW"; location / { index index.php index.html; include D:/WWW/nginx.htaccess; autoindex on; } location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9010; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } }
Apache
Cut conf (not optional)
AddInclude conf/vhosts/*.conf
Configuring multiple versions of PHP
Add # in the conf file ##FcgidInitialEnv PHPRC "D:/Extensions/php/php8.2.2-nts" AddHandler fcgid-script .php FcgidWrapper "D:/Extensions/php/php8.2.2-nts/php-cgi.exe" .php
Just specify the corresponding directory.
Recommended learning: "
PHP Video TutorialThe above is the detailed content of Let's talk about Nginx and Apache configuring multiple versions of PHP. For more information, please follow other related articles on the PHP Chinese website!