PHP / .htaccess / session error

#1
Hi! I'm an Eleven2 customer. They recently upgraded from Apache to LiteSpeed, and now my site is having problems. I was asked by their support team to post my issue here since they were unable to resolve it.

I'm just beginning to try to build a PHP / MySQL app at http://www.prebeltway.org, and in order to make my URLs more friendly, I've added the following lines to my .htaccess file:

Code:
<Files family> 
ForceType application/x-httpd-php 
</Files>

<Files abilene> 
ForceType application/x-httpd-php 
</Files>

<Files sweetwater> 
ForceType application/x-httpd-php 
</Files>
as illustrated at http://www.sitepoint.com/article/search-engine-friendly-urls/3 so that these files can be served as PHP without requiring a file extension.

Before the upgrade everything worked perfectly. And now, most everything still seems to work, except that it doesn't hold sessions anymore for some reason. A user can log in, and pages with a .php extension (the login page, the index page, etc.) show the user logged in, but the files with no extension (abilene, sweetwater, and family pages) show the user logged out because no session is registering. If I simply add the file extension ".php" to the non-working files, the functionality returns, and users can stay logged in there as well.

You can test this for yourself at http://www.prebeltway.org/login.php using the username "demo" and the password "test." Once you are logged in, note that the "login" link changes to "logout" specifying that you are logged in. Now visit http://www.prebeltway.org/abilene and see that the link has reverted to "login" because the session has not initiated on this page. If you now go to http://www.prebeltway.org/abilene.php (which is an exact duplicate of the previous page, just with the .php extension added), you will see that you are, in fact, still logged in.

This seems to be a bug in the way that LiteSpeed handles ForceType in .htaccess, but if there is a work-around that I or Eleven2 can implement, please let me know and we'll give it a shot!

Thanks!

--Josh
 

mistwang

LiteSpeed Staff
#2
configuration
Code:
<Files abilene> 
ForceType application/x-httpd-php 
</Files>
let web server server "abilene" as PHP script, as you noticed that, it does serve as PHP.

PHP session is managed by php engine internal, I doubt it was affected by the web server.

But anyway, seems the PHP engine like the file with ".php" suffix, let try implementing the friendly URL with rewrite rule"

Code:
RewriteEngine on
RewriteRule ^(family|abilene|sweetwater)$  $1.php [L]
See if it help.
 

mistwang

LiteSpeed Staff
#3
OK, we figured out the problem, ForceType uses the global PHP process instead of suEXEC PHP under your own ID. so it has permission issue to access the session file. Will fix this.
 
Top