Jan_E
Verified User
I just had a hard time getting drupal 7 to work under PHP 5.4 as php-fpm. My options.conf:
Drupal 7 normally rewrites every URL in the .htaccess with something like:
After a lot of debugging I found out that inside mod_rewrite with PHP 5.4 as php-fpm the %{REQUEST_FILENAME} and %{REQUEST_URI} are different. When requesting /index.php these variables have the following values inside mod_rewrite:
# http://vps2.arsetlabor.co.uk/index.php
# %{REQUEST_FILENAME} = /home/arsetlabor/public_html/index.php54
# %{REQUEST_URI} = /fastcgiphp54arsetlabor/index.php
Arsetlabor is the user.
So now my working drupal 7 .htacces starts with:
and ends with
The different values for REQUEST_FILENAME and REQUEST_URI inside mod_rewrite will probably fail in a lot more frameworks than just Drupal 7. Is there a generic solution to make mod_rewrite in php-fpm work just like mod_rewrite in mod_php?
I am now going to try PHP 5.4 as suphp to see if that makes it easier.
Code:
php1_release=5.3
php2_release=5.4
php1_mode=mod_php
php2_mode=php-fpm
...
apache_ver=2.4
mod_ruid2=yes
secure_htaccess=no
harden-symlinks-patch=no
Code:
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !=/phpinfo.php
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# http://vps2.arsetlabor.co.uk/index.php
# %{REQUEST_FILENAME} = /home/arsetlabor/public_html/index.php54
# %{REQUEST_URI} = /fastcgiphp54arsetlabor/index.php
Arsetlabor is the user.
So now my working drupal 7 .htacces starts with:
Code:
<IfModule mod_fastcgi.c>
<FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|phtml|phps)$">
SetHandler php54-fcgi
</FilesMatch>
</IfModule>
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
# php-fpm
# http://vps2.arsetlabor.co.uk/index.php
# %{REQUEST_FILENAME} = /home/arsetlabor/public_html/index.php54
# %{REQUEST_URI} = /fastcgiphp54arsetlabor/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !=/phpinfo.php
RewriteCond %{REQUEST_URI} !=/fastcgiphp54arsetlabor/phpinfo.php
RewriteCond %{REQUEST_URI} !=/fastcgiphp54arsetlabor/index.php
# uncomment to debug with Opera's (not) Enable Automatic Redirection
# RewriteRule ^(.*)$ /index.php?q=$1&rf=%{REQUEST_FILENAME}&ru=%{REQUEST_URI} [R=301,L]
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
I am now going to try PHP 5.4 as suphp to see if that makes it easier.