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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > litespeed, fastcgi apache incompatibility

Reply
 
Thread Tools Display Modes
  #1  
Old 05-02-2012, 09:13 PM
accassar accassar is offline
Member
 
Join Date: Feb 2012
Posts: 31
Default litespeed, fastcgi apache incompatibility

Hi Guys,

I've found the reason for the rewrite issues with litespeed and PHP running under fastcgi.

The issue is that fastcgi sends different variables over the fastcgi connection then apache - which results in PHP not interpreting PATH_INFO correctly.

If you compare the output from the fastcgi variables below, especially the path_translated and path_info as that is what the PHP fastcgi handlers care about, you will see the obvious error. All the complaints on the forums about PHP saying 'file not found' for this style of URL can be explained in the differences below.

Is there any chance if LSWS being updated? I don't really want to change the fastcgi code in PHP to work with LSWS if I can help it, and I haven't checked if LSAPI works correctly or not - but for this particular use case (and I imagine many others where there is a migration from webserverX -> litespeed) this is the best option forward.

FastCGI request from Apache:

SERVER_SOFTWAREApache
SERVER_NAMEtest.com
SERVER_ADDR1.2.3.4
SERVER_PORT80
REMOTE_ADDR1.2.3.4
DOCUMENT_ROOT/my/document/root
SERVER_ADMINtest@test.com
SCRIPT_FILENAME/bin/php5 <- from apache config
REMOTE_PORT53960
REDIRECT_URL/index.php/category/library
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
REQUEST_URI/category/library
SCRIPT_NAME/fcgi-bin/php5ac <- from apache config
PATH_INFO/index.php/category/library
PATH_TRANSLATED/my/document/root/index.php/category/library

Request method from LSWS:

GATEWAY_INTERFACECGI/1.1
SERVER_SOFTWARELiteSpeed
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
SCRIPT_FILENAME/my/document/root
QUERY_STRING
SCRIPT_NAME/index.php/category/library
DOCUMENT_ROOT/my/document/root
REMOTE_ADDR1.2.3.4
REMOTE_PORT50424
SERVER_ADDR1.2.3.4
SERVER_NAMEtest.com
SERVER_ADMIN
SERVER_PORT8088
REQUEST_URI/category/library
PATH_TRANSLATED/my/document/root/category/library
PATH_INFO/category/library
Reply With Quote
  #2  
Old 05-03-2012, 01:42 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
just list the difference from your post to be more clear:
Quote:
~>diff apache lsws
1,6c1,6
< PATH_INFO /index.php/category/library
< PATH_TRANSLATED /my/document/root/index.php/category/library
< REDIRECT_URL /index.php/category/library
< SCRIPT_FILENAME /bin/php5 <- from apache config
< SCRIPT_NAME /fcgi-bin/php5ac <- from apache config
< SERVER_SOFTWARE Apache
---
> PATH_INFO /category/library
> PATH_TRANSLATED /my/document/root/category/library
> QUERY_STRING
> SCRIPT_FILENAME /my/document/root
> SCRIPT_NAME /index.php/category/library
> SERVER_SOFTWARE LiteSpeed
if able to covert to LSAPI php, that'll be better. since lsphp can be regarded as optimized fast cgi and best performance in corporation with litespeed web server.
Reply With Quote
  #3  
Old 05-03-2012, 04:37 PM
accassar accassar is offline
Member
 
Join Date: Feb 2012
Posts: 31
I can't convert from FastCGI to LSPHP at this stage while we do the migration.

PATH_INFO/index.php/category/library <- apache
PATH_INFO/category/library <- LSW

PATH_TRANSLATED/my/document/root/index.php/category/library <- apache
PATH_TRANSLATED/my/document/root/category/library <- LSW

From the above which I obtained via tcpdump, you can see that LSW does not pass the PHP file through to the fastcgi runner in either the PATH_INFO or PATH_TRANSLATED variables. The PHP fastcgi runner cannot find the php file in question, hence the error about not finding the file.

I believe if you can resolve this issue, this will improve compatibility with apache when migrating client sites. In my original thread it required changing the clients rewrite rule, however if the correct FASTCGI variables are passed to PHP - no change will be required.








Quote:
Originally Posted by NiteWave View Post
just list the difference from your post to be more clear:


if able to covert to LSAPI php, that'll be better. since lsphp can be regarded as optimized fast cgi and best performance in corporation with litespeed web server.
Reply With Quote
  #4  
Old 05-09-2012, 04:00 PM
accassar accassar is offline
Member
 
Join Date: Feb 2012
Posts: 31
Any feedback?
Reply With Quote
  #5  
Old 05-09-2012, 08:34 PM
accassar accassar is offline
Member
 
Join Date: Feb 2012
Posts: 31
The problem is not the build, the problem is the way that lsws is passing the fastcgi variables. This is why PATH_INFO does not with with PHP and fastcgi. Please read the previous posts.

Quote:
Originally Posted by webizen View Post
you can run build php with fastcgi support under lsws.

http://www.litespeedtech.com/how-tos.html#qa_phpfcgi
Reply With Quote
  #6  
Old 05-09-2012, 09:41 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
Quote:
Originally Posted by accassar View Post
The problem is not the build, the problem is the way that lsws is passing the fastcgi variables. This is why PATH_INFO does not with with PHP and fastcgi. Please read the previous posts.
That's why the post was removed already.

We tested in our lab run php with fcgi support under both Apache and LSWS. It shows that Apache and LSWS have the same path info but different path_translated (index.php removed in LSWS path_translated as you pointed out). however, script_filename is the same as path_translated in Apache which is different from your result.

Quote:
Apache
--------
PATH_INFO:/category/library
PATH_TRANSLATED:/path/to/php-fcgi/index.php
SCRIPT_FILENAME:/path/to/php-fcgi/index.php

LSWS
------
PATH_INFO:/category/library
PATH_TRANSLATED:/path/to/php-fcgi/category/library
SCRIPT_FILENAME:/path/to/php-fcgi/index.php
Maybe you can pm your setup to help reproduce that?
Reply With Quote
  #7  
Old 05-09-2012, 10:44 PM
accassar accassar is offline
Member
 
Join Date: Feb 2012
Posts: 31
I think I've sent you a pm with the details. Let me know if it's not received.
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 12:14 AM.



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