|
|

03-20-2009, 03:05 AM
|
|
Senior Member
|
|
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
|
|
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!
|

03-20-2009, 07:12 AM
|
|
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.
|

03-20-2009, 07:26 AM
|
|
Senior Member
|
|
Join Date: Mar 2009
Location: Athens, Greece
Posts: 60
|
|
That did it. Thank you very much! 
|

04-09-2009, 05:37 PM
|
|
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
|

04-09-2009, 05:40 PM
|
|
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(); ?>
|

04-09-2009, 05:42 PM
|
|
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
|

04-09-2009, 05:53 PM
|
|
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.
|

04-28-2009, 06:28 AM
|
|
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?
|

04-28-2009, 01:07 PM
|
|
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.
|

04-28-2009, 04:33 PM
|
|
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.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:01 PM.
|
|