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: Overriding Apache version for directory (fastcgi) |
|
Author |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Wed 06 Jul '16 1:09 Post subject: Overriding Apache version for directory (fastcgi) |
|
|
I want to override the PHP version for one of the directory's of my website. Because the forum application in there is not compatible with PHP 7.
To do this I've tried adding this to my .htaccess file:
Code: |
<IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp5.6 .php
Action application/x-httpd-fastphp5.6 /php5.6-fcgi
Alias /php5.6-fcgi /usr/lib/cgi-bin/php5.6
FastCgiExternalServer /usr/lib/cgi-bin/php5.6 -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule> |
Unfortunately that doesn't work as we can't use Alias and FastCGiExternalServer in .htaccess files.
I then tried adding
Code: | <Directory /var/www/xgclan.com/public_html/forum/>
<IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp5.6 .php
Action application/x-httpd-fastphp5.6 /php5.6-fcgi
Alias /php5.6-fcgi /usr/lib/cgi-bin/php5.6
FastCgiExternalServer /usr/lib/cgi-bin/php5.6 -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
</Directory>
|
In to my virtual host file but this doesn't work either, because Code: | Alias cannot occur within <Directory/Location/Files> section |
I'm not quite sure what else to do.
I could move the forum application to it's own subdomain with it's own virtualhost, but that is a little drastic and I'd like to consider other options first. |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Wed 06 Jul '16 1:28 Post subject: |
|
|
Got it working
Simply add:
Code: |
<IfModule mod_fastcgi.c>
Alias /php5.6-fcgi /usr/lib/cgi-bin/php5.6
FastCgiExternalServer /usr/lib/cgi-bin/php5.6 -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
|
To the apache2.conf (or modules fastcgi.conf)
Then in .htaccess
Code: |
<IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp5.6 .php
Action application/x-httpd-fastphp5.6 /php5.6-fcgi
</IfModule>
|
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Wed 06 Jul '16 7:16 Post subject: |
|
|
gijs wrote: | Then in .htaccess
Code: | <IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp5.6 .php
Action application/x-httpd-fastphp5.6 /php5.6-fcgi
</IfModule>
|
|
Could you replace this by something in your conf-files (after the code with the alias definition):
Code: | <Directory /var/www/xgclan.com/public_html/forum/>
<IfModule mod_fastcgi.c>
AddType application/x-httpd-fastphp5.6 .php
Action application/x-httpd-fastphp5.6 /php5.6-fcgi
</IfModule>
</Directory> |
I always try to avoid changes like this in the .htaccess... |
|
Back to top |
|
|
|
|
|
|