The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP4 and PHP5 needed on the same site

Discussion in 'General Discussion' started by RRWD, Aug 12, 2011.

  1. RRWD

    RRWD Registered

    Joined:
    Aug 12, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Let me start by saying I am a website developer and really know nothing when it comes to server administration so please make your answers as complete as possible and don't assume I know anything at all.

    I was recently hire to fix a site that was broken after previous developer made some additions to the site. After doing some investigation I found the problem to be the fact that the new addition required PHP5 whereas some of the code is dependent on PHP4. It's actually one group of folders that require the PHP4.

    The current configuration is

    Default PHP Version (.php files) 5
    PHP 5 Handler dso
    PHP 4 Handler cgi
    Apache suEXEC on

    I created a .htaccess file with "AddHandler application/x-httpd-php4 .php .php4 .php3" and put it in the folder where PHP4 is needed and now I get:

    "# If you customize the contents of this wrapper script, place # a copy at /var/cpanel/conf/apache/wrappers/php4 # so that it will be reinstalled when Apache is updated or the # PHP handler configuration is changed exec /usr/php4/bin/php "


    That is pretty much Greek to me. Can someone walk me through what needs to be done to make this function properly?

    Thanks for your time!
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I put the following into the .htaccess file on a subfolder to get CGI working with PHP4 for a test account:

    Code:
    Action application/x-httpd-php4 /cgi-sys/php4
    AddType application/x-httpd-php4 .php4 .php .php3 .php2 .phtml
    This matches exactly what /usr/local/apache/conf/php.conf would have if PHP 4 with CGI were the default. Normally, the best way to troubleshoot exactly what is needed for the .htaccess would simply be to switch to PHP 4 as the default, copy what it uses in /usr/local/apache/conf/php.conf and then use that in the .htaccess for the account. At that point, you can then switch it back to PHP 5 as the default again.

    To see this working:

    phpinfo() <-- PHP 4 with CGI set by .htaccess
    phpinfo() <-- PHP 5 with DSO set as default
     
  3. RRWD

    RRWD Registered

    Joined:
    Aug 12, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    How do I find /usr/local/apache/conf/php.conf ? Please give as much detail as possible please.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...
Similar Threads - PHP4 PHP5 needed
  1. durangod
    Replies:
    2
    Views:
    218

Share This Page