LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > PHP / .htaccess / session error

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2007, 08:59 AM
infinivert infinivert is offline
New Member
 
Join Date: Jul 2007
Posts: 6
Unhappy PHP / .htaccess / session error

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/sea...riendly-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
Reply With Quote
  #2  
Old 07-16-2007, 09:32 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #3  
Old 07-16-2007, 10:56 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #4  
Old 07-16-2007, 11:27 AM
infinivert infinivert is offline
New Member
 
Join Date: Jul 2007
Posts: 6
Excellent! Thank you so much! This will make my life MUCH easier.

Much appreciation!

--Josh
Reply With Quote
  #5  
Old 07-16-2007, 12:51 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
OK. Fixed.
Reply With Quote
  #6  
Old 07-16-2007, 01:05 PM
infinivert infinivert is offline
New Member
 
Join Date: Jul 2007
Posts: 6
Wow. I'm seriously amazed! Thank you so much!

--Josh
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:20 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.