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.

running php5 as suphp, what are my optimizer options ?

Discussion in 'Workarounds and Optimization' started by SherifBuzz, Apr 8, 2011.

  1. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    hi all, i've read lots of conflicting information about which optimizers work with php as suphp - i have eEccelerator running but i've read that it's not actually doing anything when running php as suphp. Does anyone have first-hand experience with running an optimizer on php-suphp ? If not, then what is the best setup to use (php as dso/apc, etc) ? thank you.
     
  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
    None of the OPCode will work for suPHP, so APC, XCache and EAccelerator will not work with suPHP due to how it functions.

    If you require OPCode for optimization of PHP, then you'd have to use either DSO or FCGI. Of the two options, DSO and FCGI, DSO is more well-known and easier to work with but less secure due to the fact processes run as the user nobody and you must have higher file permissions frequently for PHP scripts to run; FCGI is more secure and almost as fast as DSO, but it is harder to get a working configuration and less well-known whenever anything goes wrong and you need assistance.
     
  3. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your reply. In your opinion, is it worth it ? Going through the effort and switching to DS0+APC ?
     
  4. 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
    If you really need the speed up for PHP sites and the reduction in load levels for the machine in general, then it would be worth it to switch to DSO. I'd really only suggest doing this if you are good with keeping the machine up-to-date for PHP scripts and not allowing insecure options in your php.ini file. Security will be the biggest concern on switching to DSO, but you will definitely have an improvement in options for optimization and reduction in server load.
     
  5. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    thank you.

    Can you pls point me in the right direction of how to switch to DSO ? I assume this involves recompiling apache/php using EasyApache - do I just uncheck the "Mod SuPHP" option in page 5 of the wizard ?

    thanks again.
     
  6. 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
    You likely wouldn't need to recompile Apache. You can either select DSO in WHM > Apache Configuration > PHP and SuExec Configuration area or run a command similar to the following in root SSH to switch the handler for PHP5 systems:

    Code:
    /usr/local/cpanel/bin/rebuild_phpconf 5 none dso 1
    The above would set PHP 5 as the default, set no handler for PHP4 (this is what the none means), set dso for PHP5 and set SuExec to "on" state (1 is on and 0 is off).
     
  7. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi there, I had looked in the "PHP and SuExec Configuration" options page, but there is no option for DSO - I only have suphp/fcgi/cgi/none.
     
  8. 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
    That's a bit strange as DSO should always be part of the module build since there isn't a select option in EasyApache to build it. Can you try running the command I provided in root SSH and then run the following afterward:

    Code:
    /usr/local/cpanel/bin/rebuild_phpconf --current
    If you receive any errors, please note the error message.
     
  9. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi there, I have a live site running on my vps so I cannot run anything now that might break the site (I know switching to DSO now would because I have custom a php.ini).

    I will open a ticket to my hosting company about that issue and get back to you here. thanks for your support.
     
  10. 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
    Certainly, please let us know how it goes.
     
  11. ARPLink

    ARPLink Member

    Joined:
    Mar 7, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi
    Actually, SherifBuzz has a point about DSO dissapearing. If you compile Apache with SuPHP and FCGI options(if I remember corectly), DSO will not show up in the handler list and the only options will be: None, SuPHP, CGI, FCGI. It happened to me about 2 weeks ago when I was playing around with a VPS.
     
  12. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    I had to rebuild apache/php and remove the options mpm_event, and mpm_worker - now dso is listed as an option in the "PHP and SuExec Configuration" page.

    I did a quick switch test, and i'm getting a permissions error on /tmp :

    Warning: session_start() [function.session-start]: open(/tmp/sess_7539a1d6c5297eb8a85382e06725f70e, O_RDWR) failed: Permission denied (13) in ....

    I assume that the user 'nobody' needs permissions on this folder, and probably other folders - do you know is there some script that already exists to handle this or am i going to have to do it manually ?

    regards.
     
  13. 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
    Can you run a stat on /tmp and provide the results?

    Code:
    stat /tmp
    The user nobody doesn't need access to the folder. The folder simply needs to have the following permissions:

    Code:
    Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (    0/    root)
    To change to those:

    Code:
    chmod 1777 /tmp
    Unfortunately, there wouldn't be any script to manually correct permissions on user accounts. You would be able to check the Apache error logs at /usr/local/apache/logs/error_log to see any other accounts having an issue, though.
     
  14. SherifBuzz

    SherifBuzz Member

    Joined:
    Dec 2, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    stat /tmp returns :

    i guess the permission problem then is actually on previously created session files (that were created when php was running as suphp) inside tmp and not tmp itself - so i guess clearing those files when switching should do the trick ?
     
  15. 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
    If you clear those files, it should help with the issue correct.
     
  16. nobodyk

    nobodyk Well-Known Member

    Joined:
    Aug 1, 2010
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    You can also look into lite$peed and varnish

    Edit: I wouldn't run dso on a shared environment.
     
    #16 nobodyk, Apr 15, 2011
    Last edited: Apr 15, 2011
Loading...

Share This Page