Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache with multiple php version |
|
Author |
|
bagu
Joined: 06 Jan 2011 Posts: 193 Location: France
|
Posted: Fri 12 May '17 14:07 Post subject: Apache with multiple php version |
|
|
Hello,
I have some need to have two php on the same vhost.
One for www.bagu.biz, and an other for every other sub-domains.
Here is my configuration :
Code: | <VirtualHost *:80>
ServerName www.bagu.biz
DocumentRoot the_path_of_documentroot
ServerAlias bagu.biz *.bagu.biz
VirtualDocumentRoot the_path_of_documentroot/%1
Define PHP_VERSION="php7"
RewriteEngine on
RewriteCond %{HTTP_HOST} ^bagu.biz [NC]
RewriteRule ^(.*) http://www.bagu.biz$1 [R=301,L]
SetEnvIf Host "www.bagu.biz" PHP_VERSION="php"
FcgidInitialEnv PHPRC "the_path_of_php\\${PHP_VERSION}"
<IfModule fcgid_module>
<Files ~ "\.php$">
AddHandler fcgid-script .php
FcgidWrapper "the_path_of_php/${PHP_VERSION}/php-cgi.exe -d error_log=the_path_of_logs/vhost_php_error/bagu.biz.php_error.log" .php
</Files>
</IfModule>
ErrorLog the_path_of_logs/vhost_apache_error/bagu.biz.apache.error.log
<Directory the_path_of_documentroot/>
Options +FollowSymLinks -Indexes -Includes -ExecCGI
AllowOverride all
Require all granted
</Directory>
</VirtualHost> |
But, PHP_VERSION="php7" don't work...So the config don't work (Config variable ${PHP_VERSION} is not defined)...
How can i make it working as expected ?
Thanks |
|
Back to top |
|
admin Site Admin
Joined: 15 Oct 2005 Posts: 696
|
|
Back to top |
|
bagu
Joined: 06 Jan 2011 Posts: 193 Location: France
|
Posted: Fri 12 May '17 14:25 Post subject: |
|
|
Thanks, i corrected some bugs, but, it seem that my line
SetEnvIf Host "www.bagu.biz" Define PHP_VERSION "php"
don't work as expected.
Can you help me to make it working?
EDIT : i've tried SetEnvIfNoCase Host www\.bagu\.biz PHP_VERSION=php without success |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7381 Location: Germany, Next to Hamburg
|
Posted: Sun 14 May '17 12:25 Post subject: |
|
|
Why don't you setup a second vhost for the www and the other one for all the others? |
|
Back to top |
|
bagu
Joined: 06 Jan 2011 Posts: 193 Location: France
|
Posted: Sun 14 May '17 13:15 Post subject: |
|
|
I wanted to avoid making a specific configuration, but that's what I ended up doing. Too bad, because I find it less flexible. |
|
Back to top |
|
|
|
|
|
|