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.

PHP not working correctly after Easyapache

Discussion in 'EasyApache' started by vizzit, Jan 7, 2010.

  1. vizzit

    vizzit Member

    Joined:
    Jan 7, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    After trying several profiles including basic and customised and previous working profile, Apache start and up and running ok, in command line I can do PHP -i and php -r and php -v fine no problem. I had to reset PHP+SUExec manually, but still no joy. when it comes to processing php files on the web it asks to download file. Any ideas?
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    create a .htaccess file under the account in question i.e. under the public_html directory and add the following line

    AddHandler application/x-httpd-php .php .php5
     
  3. vizzit

    vizzit Member

    Joined:
    Jan 7, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    PHP is now working had to allow for mime types to establish.

    I now have http:500 error looked in httpd logs cant see much in there
     
  4. xrserver

    xrserver Well-Known Member

    Joined:
    Jan 18, 2008
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    try running
    Code:
    tail -f /usr/local/apache/logs/error_log
    then refresh the page getting the 500 error several times and post the errors you see from the error log here.
     
  5. vizzit

    vizzit Member

    Joined:
    Jan 7, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Was't really coming up with anything, I did find in one of the php logs for the main site that extensions directory was't being found as it had changed since running easy apache.

    Then completely cleared the tmp dir as some of the session files were not writable.

    Did a full reboot, still no joy, so reinstalled via easyapache selecting some different php options.

    ran /usr/local/cpanel/bin/rebuild_phpconf 5 none cgi 1

    and all up and running now.

    Not sure what fixed it maybe clearing tmp and reinstall and rebuild php config from shell got it going.

    Need to do some more tests with php but up and runing for now.
     
  6. SGM

    SGM Registered

    Joined:
    Nov 22, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Today I also ran in a similar problem. It seems that the command line utility solved it. I used this command:
    Code:
    /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1
    as I'm running PHP with suPHP.

    Hope this helps.

    P. S. Forgot to mention - keep in mind browsers like to cache things, so after i run the above command Firefox didn't send a new request to the server, but kept offering to download the file from the cache.
     
    #6 SGM, Feb 12, 2011
    Last edited: Feb 12, 2011
  7. ghalman

    ghalman Member

    Joined:
    Apr 17, 2002
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi there!!!

    I had similar issues (same symptoms); and I documented this for all of your reference... It took my whole day! Thanks for help from my Guru Engineer - SGM!

    When it was upgraded, it had issues; i was attending a class today and whole day worked on it (almost 8 hours) and finally fixed the problem.

    here is my feedback:
    a. upgraded easyapache via WHM with php 5.3.4 and apache 2.2; after recompile everything, the php failed
    b. had ffmpeg installed in php; removing that didnt fix the problem.
    c. recompiled manytimes; but no resolution.
    d. and php fixed using command line
    /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1

    I tried to upgrade whm almost 10 times.

    when easyapache completes the process, it shows the final php-build-conf with the options 5 none none 1 ---- this time, it did not show, and somehow it was not taking affect.


    the very last part need to be configured ... but it was failing. using correct command line it was ok... using suphp. I used cpanel to ocnfigure suphp but it didnt takes affect. MORAL OF STORY: problem is with cpanel upgrade process ; and or easyapache process.... it is broken somewhere!

    following your method did not fix the problem as is... need to enable suphp via commad line (whm was not doing it! even when explicitly selected the options... at the completion of easyapache upgrade, it was not presenting the options...)
     
    #7 ghalman, Feb 12, 2011
    Last edited: Feb 12, 2011
  8. Cindu

    Cindu Well-Known Member

    Joined:
    Feb 7, 2011
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I have never tried this command.

    /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1

    What none denotes in this command?
     
  9. SGM

    SGM Registered

    Joined:
    Nov 22, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    none denotes the php 4 handler. According to the command help:

    Code:
    Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available] <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>
     --dryrun       : Only display the changes that would be made
     --no-restart   : Don't restart Apache after updating the php.conf link
     --no-htaccess  : Don't update user configurable PHP mime mapping.
     --current      : Show current settings
     --available    : Show available handlers and PHP SAPIs
     <Default PHP>  : Version of PHP to set as default handler for .php files
     <PHP# Handler> : Type of Apache module to use in serving PHP requests
     <Suexec>       : enabled, disabled, 1 or 0
     
  10. gkgcpanel

    gkgcpanel Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    217
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    Ok, after a EasyApache update, (and I have done this 3 times), some (not all) php files want to download instead of running.
    Adding this line fixed that issue for those sites that were having this problem.

    Question: Do I have to add this to every single users .htaccess file ?? Or is there a universal (single) file I can add this to that would handle this for all customers?

    Thank you.
     
  11. 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
    Are you using suPHP as the handler? If so, what does your /usr/local/apache/conf/php.conf file look like?

    Code:
    cat /usr/local/apache/conf/php.conf
    Next, what are the file extensions for the php pages that aren't loading? Are they ending in .php or something else? If only some of the PHP pages were trying to download and not all of them, then there has to be either a change in the extension being used or something on the account itself.
     
  12. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    I had the same problem too after easypache.

    Executing
    # php -v
    I have seen segmentation fault error related to ioncube.

    To fix the issue I edited /usr/lib/php.ini and moved following 2 lines

    extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
    zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"

    AFTER all zend lines .

    After this step , I executed
    # /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1

    and all worked ok .

    Of course take in mind the SMG note

     
  13. gkgcpanel

    gkgcpanel Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    217
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    Tristan,

    Thanks for the reply. Yes, we are using suPHP (only with PHP 5, we took out PHP 4). All files have .php as the extension as well. Initially, it started with just one site, (all other sites were working just fine), I recompiled Apache/PHP using EasyApache (like I have done a hundred times in the past) and after that, all PHP sites were affected.

    This is what is currently in our php.conf file:

    Code:
    # This file was automatically generated by the Cpanel PHP Configuration system
    # If you wish to change the way PHP is being handled by Apache on your system,
    # use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
    #
    # Manual edits of this file will be lost when Apache is updated.
    
    
    # SuPHP configuration for PHP5
    LoadModule suphp_module modules/mod_suphp.so
    suPHP_Engine on
    AddHandler application/x-httpd-php5 .php
    AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
    <Directory />
        suPHP_AddHandler application/x-httpd-php5
    </Directory>
    
    # End of autogenerated PHP configuration.
    
    
    We added the

    Code:
    AddHandler application/x-httpd-php5 .php
    To globally fix this issue for all users who were having this issue.

    That fixed it again for all users, but why it happened in the first place is the real mystery.

    I've compared the php.conf file to other servers that are working fine and they look 100% identical with the exception of that line above that I added.

    Thanks,
    Peter
     
Loading...

Share This Page