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.

FastCGI vs other options - got to work with APC

Discussion in 'Workarounds and Optimization' started by benzon, Jun 24, 2012.

  1. benzon

    benzon Registered

    Joined:
    Jun 24, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi to you all :)

    My question is proberly simple, but im gonna rent a server very soon, and currently working with the way everything shut be setup on the server.

    Im gonna use one of there official resellers, since they offer support for cPanel my host dont do that, and i want to be able to get support.

    But here is the question i belive APC is currently the best php caching plugin, and it will sooner or later from what i have read, be includet in to php disto it self, but for now its not, so fare i can se that it dossent work with suPHP, or for that matter suEXEC?, but dos it work with DSO/mod_php and/or mod_ruid2, and what is fastest and delivers the best output speed wize? the server is mainly gonna run Wordpress scripts, ad top 150 Domains, since i dont want to overload the server, and want to deliver a good hosting experience.

    Some server info.
    CPU: I7-2600 Quad with HT (I know this is a desktop processor, but compared to some of the minor Xeon processors its alot stronger, if you make some benchmarking)

    Ram: 16GB DDR3

    HDD: 2x3TB 6Gb/s they are gonna run in raid 1

    Dont think its a bad server? :)
     
  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
    Correct, suPHP doesn't work with OPCode caching. SuExec doesn't have anything to do with it, though. You can have SuExec on for DSO or FCGI and APC would still function.

    DSO + mod_ruid2 should function with OPCode caching as does FCGI.

    Right now, APC isn't provided as part of EasyApache, so you'd have to manually install and configure it.
     
  3. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi, sorry to re-open this old thread but it pertains to my issue. I am running Magento Store and soon found with FastCGI and the default file based Cache for Magento, the store is running very slow. After researching I found APC to be the answer. I used WHM to install APC Pecl Module and it was running fine. But, because Fast_CGI was used the caching did not work. If i go to apc.php and look at the files, no files were being cached. From what I read online but do not fully understand is that FastCGI spawns PHP processes separately so it really isn't set up to work with APC.

    So then I change my php.conf to run in DSO and now the APC caching is working and really fast! Can you explain how FastCGI can work with APC??

    Also, now I must chmod upload directories to 777. Is this dangerous? Could my sites be easily hacked?

    Please advise the best way to get APC to work but exposing my server to risk.

    Thanks for your help. Dan
     
  4. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Look into running Magento with mod_ruid2 and DSO. This should fix permission issues with CMS such as WordPress, Joomla and Magento. So the set up would be:

    mod_ruid2+DSO with APC enabled and folders set to 755 and files set to 644 with user:user ownership.

    Make a backup of your account before you proceed with these changes.
     
  5. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Thanks Max. I am running DSO and APC now and do have permission problems but the server runs pretty darn fast. In your opinion, if I configure with mod_ruid2 will the performance be the same or will I see a performance hit?

    Thanks, Dan
     
  6. LeadDogGraphics

    LeadDogGraphics Well-Known Member

    Joined:
    Feb 25, 2012
    Messages:
    97
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    West Palm Beach, FL
    cPanel Access Level:
    Root Administrator
    No, you won't take a performance hit. I also run mod_ruid2 with APC for WordPress hosting and it runs great.

    Just make sure your server has the standard security precautions taken care of. I would always suggest letting a professional handle your security setup/audit just in case, for around $150 you can't go wrong with knowing you are safe. Check these guys out, /http://solidshellsecurity.com/ the owner Travis is awesome at linux security.
     
  7. fightforfreedom

    Joined:
    Jan 21, 2013
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for that info.

    I've heard good things about them. I will check them out.
     
    #7 fightforfreedom, Feb 6, 2013
    Last edited: Feb 6, 2013
  8. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the info. I will check out the security experts too.
     
  9. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi, just recompiled Apache with Apache Ruid2 and it is running great and fast using APC.

    Should I leave Apache suEXEC on?

    Dan
     
  10. Jeff Shotnik

    Jeff Shotnik Well-Known Member

    Joined:
    Oct 10, 2012
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Denver, Colorado, United States
    cPanel Access Level:
    DataCenter Provider
    Mod_ruid2 allows Apache to run as the cPanel user, so why not set folders to 750 and 640? This will help if a cpanel account is hacked (via exploit in cms, etc) and used to create symlinks (by reading /etc/named.conf - can also use 640) to other accounts on the system. Even if they symlink to a good file within another cpanel accunt, they won't be able to read it.
     
  11. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hello, since I change over to mod_ruid2 my magento site crashed when APC could not allocate enough memory. I cleared the opcode cache and it is back up but now there are hits than misses showing in the APC.php control panel.

    Can some suggest how I can configure APC so that it does not crash? Do I need ot allocate more memory, or do I need a server with more RAM? I am not sure switching to ruid2 was the right thing for me..

    Any advise would be greatly appreciated. Thanks, Dan
     
  12. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Increase the following apc memory limit in php.ini:

    extension="apc.so"
    apc.enabled=1
    apc.shm_segments=1
    apc.shm_size=32M <--------- increase to higher number

    I also suggest running eAccelerator instead of APC if memory is an issue on the server. eAccelerator can also be installed via easyapache and therefore does not require manual installation like APC does. Both Op-Code caching software essentially do the same thing.

    I also can't stress enough how important it is to backup your cPanel accounts before you push account wide permission and ownership changes. The last thing you want on your hands is a site that breaks because you changed ownership on all files and folders. If mod_ruid2 does not work out for you, you can easily restore the accounts as they were before changes were made. From my experience, mod_ruid2 works perfectly with CMS such as WordPress. I recently was able to bring down a server load for a friend who was experiencing a load of 50+ on the server. I changed the handler from SuPHP to DSO with mod_ruid2 enabled and installed eAccelerator. Server load dropped to under 1 in a matter of 5 minutes! You are not always going to improve performance that much with just an Op-Code caching software alone, but it helps a lot!
     
    #12 max_payne, Feb 25, 2013
    Last edited: Feb 25, 2013
  13. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Thanks Max.

    This is what I have in my PHP.INI now:
    extension=apc.so
    apc.shm_size = 256M
    apc.num_files_hint = 10000
    apc.user_entries_hint = 10000
    apc.max_file_size = 5M

    My server has 1Gig of RAM.

    Would it be wise to set the apc.shm_size to 512M?

    I will look into switching eAccelerator also.

    Thanks, Dan
     
  14. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    That setting is too high for 1 GB of guaranteed RAM. Are you getting the 'pool memory errors' often on the site? Try the switch to eAccelerator for a few days and see how it goes.
     
  15. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    is 256MB too high?

    I made a few more tweaks to the APC config.
    apc.stat=0
    apc.optimization=0
    apc.shm_segments=1
    apc.enable_cli=1
    apc.cache_by_default=1
    apc.include_once_override=1

    I will keep an eye on it for a while. switching to eAccelerator will require me to rebuild apache which takes about 1/2 hour or so...
    So I may make the switch if I run into more problems with APC
     
  16. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi Max_Payne, just looking into this again....

    I am running a WHM/Cpanel server. Currently running Apache 2.2.23 and PHP 5.4.11

    I just checked EasyApache and if I choose the latest version of PHP, which is now showing as 5.4.12 there is no option to install EAccelerator in th eShort List or Exhaustive list of Options.

    If I choose the previous version of PHP which is 5.3.22, EAccelerator is available. Not sure why it is not included in 5.4.12 because the website says The current master branch supports PHP-5.4!

    Do you or anyone know why this is?

    Thanks
     
  17. openpotion

    openpotion Member

    Joined:
    Apr 27, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pacific Palisades, California, United States
    cPanel Access Level:
    Root Administrator
    I'm running APC, FCGI, PHP 5.3. Problem is APC runs on each php process and each user has multiple processes. You'll notice refreshing apc.php shows random different results. I'm thinking of switching to DSO + RUID2, will this cause any permission issues on my client's cpanels using joomla and wordpress?
     
  18. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hello, I recently switched to APC with DSO and Ruid2 and it works nicely for me so far.. One other thing that I learned is that you must enable Piped Logging in WHM or apache restarts every 2 hours and clears the APC cache. Once you enable it you will not see it clear anymore.

    Good luck. Thanks, Ddeo
     
  19. openpotion

    openpotion Member

    Joined:
    Apr 27, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pacific Palisades, California, United States
    cPanel Access Level:
    Root Administrator
    My problem now on dso+ruid2 is that APC is sharing between ALL users... rather than 1 apc per user? is this normal? the fragmentation is insane.
     
  20. LeadDogGraphics

    LeadDogGraphics Well-Known Member

    Joined:
    Feb 25, 2012
    Messages:
    97
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    West Palm Beach, FL
    cPanel Access Level:
    Root Administrator
    You have to move the APC settings outside of the php.ini file to create a per user cache.You can Google on how to do that, if I recall there was an article written by Chris Gillian, that will give you info on how to do so. The article does not have to do with cPanel but the idea will guide you on what needs to be done.
     
Loading...

Share This Page