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.

optimize for WordPress

Discussion in 'Workarounds and Optimization' started by 0884094, Sep 28, 2016.

Tags:
  1. 0884094

    0884094 Member

    Joined:
    Nov 14, 2013
    Messages:
    7
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    I'm building a new cPanel server whose only job will be to host 400 WordPress blogs. These are managed by my customers (I don't trust them and they don't trust each other) and they're allowed to self-install unlimited Themes/Plugins/Widgets directly from their WP admin dashboards (code that none of us trust).

    To make this work properly, I need PHP to execute under the user-ID of the customer -- PHP cannot run as "nobody" (so I guess I need the suPHP handler not DSO).

    Some customers get carried away with Themes/Plugins/Widgets and their blog home pages become really slow due to PHP interpreter startup. I think I need a PHP accelerator. Which should I use? My current choices are:

    root@mail [~]# /scripts/phpextensionmgr list
    Available Extensions:
    IonCubeLoader
    EAccelerator
    Zendopt
    Xcache
    PHPSuHosin
    SourceGuardian
    root@mail [~]#

    I don't necessarily need/want anything that will protect/encrypt source code because I'm only running other people's open-source PHP.

    I do want something that will compile the PHP into bytecode to improve response times.

    Any suggestions?

    My research:
    IonCubeLoader -- encrypts, but does it help perf?
    EAccelerator -- endoflife?
    Zendopt -- endoflife?
    Xcache -- endoflife?
    PHPSuHosin -- encrypts, but does it help perf?
    SourceGuardian -- ????

    Page More about PHP Handlers - Documentation - cPanel Documentation says that EAccelerator & XCache cannot work with suPHP handler, which I need. Perhaps other accelerators also cannot work with suPHP ???

    I'm building out a new cPanel server on AWS and plan to run the latest stable versions of everything. I really just want to get a good PHP accelerator working, so I can let that dictate any other config choices. Would appreciate pointers from any experienced admins.

    Thanks,
    x
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    I've moved this thread to our "Optimization" forum. You can review some of the previous threads in this forum to get an idea of how other users are optimizing the server configuration and to see which applications are used for this purpose. Here's one recent thread you may find helpful:

    Server cache for shared hosting?

    Thank you.
     
  3. 0884094

    0884094 Member

    Joined:
    Nov 14, 2013
    Messages:
    7
    Likes Received:
    2
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    I ended up recompiling Apache with:

    disabled: suphp
    enabled: Mod FastCGI
    enabled: Opcache

    (Opcache was added recently as a core PHP module, which probably explains why Xcache and similar are all end-of-life but still mentioned in tons of older forum posts.)

    I set my PHP handler to fcgi and enabled Apache suexec. This makes PHP run under each customers' identity but it's insanely fast compared to what I had before.

    For hosting WordPress, I also enabled gzip compression for all text responses, set 1-hour cache lifetimes, and enabled HTTP keep-alives, all of which really helped since WordPress gets so fat with all the separate JS/CSS files from different plugins. Under Apache Configuration -> Pre Main Include, I used these lines to globally enable compression and caching on all websites:

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript
    </IfModule>

    # Cache Control Settings for one hour cache
    <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=3600, public"
    </FilesMatch>

    <FilesMatch ".(xml|txt)$">
    Header set Cache-Control "max-age=3600, public, must-revalidate"
    </FilesMatch>
     
    cPanelMichael likes this.
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm happy to see you were able to receive positive results after making those changes. Thank you for taking the time to let us know the steps you took. WordPress installations are popular, so additional users are likely find the post helpful.
     
Loading...

Share This Page