Results 1 to 6 of 6
Thread: php4/5 problem
-
05-23-2008, 08:01 PM #1Web Hosting Master
- Join Date
- Apr 2004
- Location
- Atlanta, GA
- Posts
- 550
php4/5 problem
my server was just upgraded to php5 with 4 but i have 2 sites that run old php4 scripts is it possible to set in the .htacess something that tells the site to go to the php4 usr/bin and use that php ini?
-
05-23-2008, 08:54 PM #2Web Hosting Master
- Join Date
- Mar 2003
- Location
- Canada
- Posts
- 9,072
Try creating an .htaccess file under the public_html directory and add the following entry to force PHP4 instead of PHP5:
AddHandler application/x-httpd-php4 .phpRACK911 Labs | Penetration Testing | https://www.RACK911Labs.ca
www.HostingSecList.com - Security Notices for the Hosting Community.
-
05-23-2008, 10:44 PM #3Web Hosting Master
- Join Date
- Apr 2004
- Location
- Atlanta, GA
- Posts
- 550
The sort of works... here's my problem below in my .htacess
With php5: site css is all thrown off, links work. When I remove the RewriteEngine On site loads properly css works but the links error out.
With php4: When I add AddHandler application/x-httpd-php4 .php to the top of the .htaccess
and my this site requires that RewriteEngine On for the links to work. When its Off or that line is removed the site links do not load properly, BUT the css styles load correctly thats is with php5.
Now when I put AddHandler application/x-httpd-php4 .php into the .htaccess I get an error Warning: session_start() [function.session-start]: open(/tmp/sess_c297a33cfd7c02f00ceacf837e0fbec5, O_RDWR) failed: Permission denied (13) (RewriteEngine On) design does not load properly but the links work, when I turn RewriteEngine Off, the design loads properly but the links do not work
Code:DirectoryIndex index.htm index.html index.php Options -Indexes Options +FollowSymLinks ErrorDocument 403 403.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-F RewriteCond %{REQUEST_FILENAME} !-D RewriteCond %{REQUEST_URI} !^ads/ RewriteCond %{REQUEST_URI} !^shop/ RewriteRule ^(.*) index.php [L] <Files ~ "License Number.txt"> Order allow,deny Deny from All </Files> php_flag register_globals on <Limit GET POST> order allow,deny allow from all </Limit>
-
05-24-2008, 03:19 AM #4WHT Addict
- Join Date
- May 2007
- Location
- Ukraine
- Posts
- 161
Warning: session_start() [function.session-start]: open(/tmp/sess_c297a33cfd7c02f00ceacf837e0fbec5, O_RDWR) failed: Permission denied (13)
-
05-24-2008, 07:05 AM #5Web Hosting Master
- Join Date
- Apr 2004
- Location
- Atlanta, GA
- Posts
- 550
-
05-24-2008, 07:40 AM #6Web Hosting Master
- Join Date
- Apr 2004
- Location
- Atlanta, GA
- Posts
- 550
Solution / Fix: This applies to my case and may help others too
I looked at another site that was design for php4 and uses ReWriteEngine ON, that was loading fine. I noticed in the .htaccess the rewrite was formated this way.
Proper way with PHP5 & Apache 2+
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ rewrite.php?rewrite-url=$1 [QSA,L]
</IfModule>
Wrong way with PHP5/Aph 2 (but works with PHP4 and Aph 1)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-F
RewriteCond %{REQUEST_FILENAME} !-D
RewriteCond %{REQUEST_URI} !^ads/
RewriteCond %{REQUEST_URI} !^shop/
RewriteRule ^(.*) index.php [L]
So I had to add the <IfModule mod_rewrite.c></IfModule>. Now my site is working fine (i think still testing) with php5 and no addhandlers for php4. I will update if I notice any issues.