Results 1 to 6 of 6

Thread: php4/5 problem

  1. #1
    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?

  2. #2
    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 .php
    RACK911 Labs | Penetration Testing | https://www.RACK911Labs.ca

    www.HostingSecList.com - Security Notices for the Hosting Community.

  3. #3
    Join Date
    Apr 2004
    Location
    Atlanta, GA
    Posts
    550
    Quote Originally Posted by Pat H View Post
    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 .php
    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>

  4. #4
    Join Date
    May 2007
    Location
    Ukraine
    Posts
    161
    Warning: session_start() [function.session-start]: open(/tmp/sess_c297a33cfd7c02f00ceacf837e0fbec5, O_RDWR) failed: Permission denied (13)
    see what user php4 scripts are running under, and check if he has write permissions on /tmp directory. In fact, the error states that php can`t create a temporary session file in /tmp.

  5. #5
    Join Date
    Apr 2004
    Location
    Atlanta, GA
    Posts
    550
    Quote Originally Posted by anatolijd View Post
    see what user php4 scripts are running under, and check if he has write permissions on /tmp directory. In fact, the error states that php can`t create a temporary session file in /tmp.
    how would i check premession and set access to the /tmp folder. the error started after upgrading apache and php

  6. #6
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •