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

Go Back   LiteSpeed Support Forums > External Applications > PHP > htaccess & php[45]-script

Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2009, 03:05 AM
priestjim priestjim is offline
Senior Member
 
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
Default htaccess & php[45]-script

Hi!

I am trying to give my Plesk hosting clients a method of choosing between php4 and php5 without changing something in Plesk's configuration files. The quickest and most unobtrusive solution I've come so far is using .htaccess files inside the client's httpdocs directory with this line:

Code:
AddHandler php5-script php php3 php4 php5
to force PHP5 versioning and

Code:
AddHandler php4-script php php3 php4 php5
to force PHP4 versioning.

Unfortunately, while changing from PHP4 to PHP5 works, the other way around does not (PHP5->PHP4). Am I doing something wrong? Is it a bug?

Thanks in advance!
Reply With Quote
  #2  
Old 03-20-2009, 07:12 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
use "AddType application/x-httpd-php[4|5] php php3 php4 php5" instead.
Reply With Quote
  #3  
Old 03-20-2009, 07:26 AM
priestjim priestjim is offline
Senior Member
 
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
That did it. Thank you very much!
Reply With Quote
  #4  
Old 04-09-2009, 05:37 PM
kamran kamran is offline
New Member
 
Join Date: Apr 2009
Posts: 2
Hello,
I want PHP to work in my HTML files with .htacess

I added

AddType application/x-httpd-php .html .htm

I tested my html file with php code but it is showing blank page, what should I use, any idea would be great.

Regards,
Pasha
Reply With Quote
  #5  
Old 04-09-2009, 05:40 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
that mean php code problem, so try a simple php command like <?php phpinfo(); ?>
Reply With Quote
  #6  
Old 04-09-2009, 05:42 PM
kamran kamran is offline
New Member
 
Join Date: Apr 2009
Posts: 2
I tried simple one. like phpinfo code but it is not working. My question am I using correct syntax in htaccess?

Regards,
Pasha
Reply With Quote
  #7  
Old 04-09-2009, 05:53 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
It looks correct. how about .php file? works as expected?

Check the server level script handler configuration from LSWS console. You should have a script handler for 'php', if not, only have script handler for 'php5', then you need to change the MIME type to "application/x-httpd-php5", it must match the script handler configuration.
Reply With Quote
  #8  
Old 04-28-2009, 06:28 AM
priestjim priestjim is offline
Senior Member
 
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
A month after running correctly using the configuration described here, LS is giving me issues when selecting a PHP version on the fly. Let me explain:

I added the following directive to an .htaccess file in httpdocs:
AddType application/x-httpd-php4 php php3 php4 php5

Then I tried to open a classic info.php (phpinfo()) page to verify that the mod worked but instead I got the default Redhat info page. The weird part is that info.php4 with the .htaccess removed displays the correct PHP4 info! The even weirder thing is that on another server I got with the EXACT same configuration and php versions/compiles everything is running correctly.

Both PHP4 & PHP5 are recompiled with my options through LS's interface and everything else works correctly. The problem occurs with LS versions 4.0 through 4.0.3

Error log gives me:
2009-04-28 14:05:07.245 [ERROR] [83.235.175.46:2974-0#APVH_realestatemillennium.gr:80] MIME type [application/x-httpd-php4] for suffix '.php' does not allow serving as static file, access denied!
2009-04-28 14:05:07.245 [NOTICE] [83.235.175.46:2974-0#APVH_realestatemillennium.gr:80] Content len: 29, Request line:
(null)

Any suggestions?
__________________
Web hosting, Domain Names, VPS and Dedicated Servers in one of the most secure, reliable, fast and low-cost web hosting services in the European market.

:: dnHost Interactive Agency :: Supporting and providing Litespeed Web Server in all shared hosting and VPS servers since 2008 ::
Reply With Quote
  #9  
Old 04-28-2009, 01:07 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You have to have a "Script Handler" for "php4" defined at server level from LSWS web console.
Reply With Quote
  #10  
Old 04-28-2009, 04:33 PM
priestjim priestjim is offline
Senior Member
 
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
I already have. .php4 scripts are working fine! In addition, converting to
AddType application/x-httpd-php5 php php3 php4 php5
from
AddType application/x-httpd-php4 php php3 php4 php5
which makes no sense since php5 is the default handler for php files but just for the heck of it, gives me no error whatsoever.
__________________
Web hosting, Domain Names, VPS and Dedicated Servers in one of the most secure, reliable, fast and low-cost web hosting services in the European market.

:: dnHost Interactive Agency :: Supporting and providing Litespeed Web Server in all shared hosting and VPS servers since 2008 ::
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:01 PM.



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