1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Best PHP Configuration Settings?

Discussion in 'Site & Server Administration' started by MyBB Hoster, Sep 21, 2013.

  1. #1
    Does anyone have a really good configuration settings for Apache, Litespeed or nginx? All I plan on hosting is forums and would like to optimize my VPS to the fullest.

    Regards, Mike
    SEMrush
     
    Last edited: Sep 21, 2013
    MyBB Hoster, Sep 21, 2013 IP
    SEMrush
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    225
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    RoseHosting, Sep 21, 2013 IP
  3. makeit easy

    makeit easy Active Member

    Messages:
    2,067
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Caching php and database will give you a better performance and stability. But you will need more RAM. Also optimizing your http engine will require you to add more RAM to your VPS. 1.5 GB RAM is enough for most of the high traffic sites like top 50k at alexa.
     
    makeit easy, Sep 23, 2013 IP
  4. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #4
    I currently have 2GB RAM and 4GB BURST I think that should be good enough right? Now what would be the best option for caching like your recommending is it Apache etc? Thanks for the reply.
     
    MyBB Hoster, Sep 23, 2013 IP
  5. makeit easy

    makeit easy Active Member

    Messages:
    2,067
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Yes 2gb ram should be enough even more than enough for a single wp, drupal or similar site. APC is the best for a PHP caching in my opinion. Apache is a http server. Apache optimization is different. You need to increase your current Apache values (eg, max client). If your VPS has a control panel, especially if it has a cpanel, you can play with the default Apache settings easily. However your VPS should also need a good internet connection like 10 mbps or more. If your VPS has a 1 mbps connection, don't expect much from your optimization efforts. Also Mysql optimization plays a very important role to speed up your site.
    So, basically VPS optimization is a combination of database, php, http and sometimes dns optimizations. Also you should regularly update your VPS system files and your site CMS files. Once a week or month is enough since linux and linux based applications are already a secure and optimized systems.
     
    makeit easy, Sep 24, 2013 IP
  6. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #6
    So your saying that I should stick with Apache? I will be only hosting forums on this server. MyBB to be exact. I recently installed nginx and I am a first time user. I believe they are running together. How should I configure that? Thanks again.
     
    MyBB Hoster, Sep 24, 2013 IP
  7. ssrulz1

    ssrulz1 Active Member

    Messages:
    242
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    70
    #7
    If you host high traffic forums in the server, please go for Apache + Nginx with Xcache support. Also, replace suphp with mod_ruid that will improve the performance. (Suphp is not compatible with Php accelerators). Apache alone is not a good choice if you have high traffic websites.

    I own a high traffic forum (with 2k visitors) and the mentioned options worked for me. (Thanks to Jonathan from Onlinecares to optimize the server with the above mentioned softwares and some other mysql tweaks).
     
    ssrulz1, Sep 24, 2013 IP
  8. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #8
    Thank you for your response. I will definitely give this a try. I need to learn how to tweak the configurations correctly and disable what I don't need. I have rebuilt apache with the recommended settings. I done nothing to the nginx since installation except getting rid of the bad gateway error and get it working to show websites. Is there anything special I should do to nginx? Thanks again guys.
     
    MyBB Hoster, Sep 25, 2013 IP
  9. makeit easy

    makeit easy Active Member

    Messages:
    2,067
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #9
    I can't comment on nginx. I don't know about it. I know apache and litespeed maybe one more http. Apache is best for my knowledge. Litespeed is not good as advertised.
     
    makeit easy, Sep 25, 2013 IP
  10. ssrulz1

    ssrulz1 Active Member

    Messages:
    242
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    70
    #10
    Nginx can be tweaked, however that is above my knowledge level.
     
    ssrulz1, Sep 26, 2013 IP
  11. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #11
    I noticed that the server runs a lot smoother and faster with nginx so I am going to continue using it. Now my question is does nginx and apache run together or solo. I have nginx admin installed as mentioned before. Thanks.
     
    MyBB Hoster, Sep 26, 2013 IP
  12. ssrulz1

    ssrulz1 Active Member

    Messages:
    242
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    70
    #12
    Nginx works with Apache.
     
    ssrulz1, Sep 27, 2013 IP
  13. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #13
    for nginx try nginxcp.com
     
    Pathan, Sep 27, 2013 IP
  14. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #14
    Thanks for the clarification. So I need to fine tune both. I understand now.
    That is the one I am currently using. I need to learn some nginx tweaking its new to me.
     
    MyBB Hoster, Sep 27, 2013 IP
  15. EthernetServers

    EthernetServers Active Member

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #15
    What are you favouring most in your PHP configuration, security or performance?
     
    EthernetServers, Sep 30, 2013 IP
  16. MyBB Hoster

    MyBB Hoster Active Member

    Messages:
    64
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #16
    Performance is what im aiming for. Thank you.
     
    MyBB Hoster, Sep 30, 2013 IP
  17. monkeye

    monkeye Member

    Messages:
    307
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    33
    #17
    If the time that takes a page to open is your main concern then go for apache prefork+mod_php

    The downside is that such setup is resources hungry as each apache process is dedicated to a single TCP connection.
     
    monkeye, Oct 3, 2013 IP
  18. shiv saroya

    shiv saroya Member

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #18
    <IfModule mod_php5.c>
    php_value include_path ".:/usr/local/lib/php"
    php_admin_flag engine on
    </IfModule>
    <IfModule mod_php4.c>
    php_value include_path ".:/usr/local/lib/php"
    php_admin_flag engine on
    </IfModule>
     
    shiv saroya, Oct 25, 2013 IP
  19. infinitnet

    infinitnet Member

    Messages:
    56
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    35
    #19
    There is nothing like a "best PHP configuration". It depends on your needs, your server specifications, the exact software you host and much more. Generally speaking, if you aim for performance as you mentioned, you should use mod_php as a PHP handler. If you have plenty of RAM, you might want to try PHP-FPM as well. If the extra costs fit your business plan, use LiteSpeed instead of Apache. It's PHP handler is really fast and secure at the same time and it's serving static files lighting fast (like NGINX, but NGINX doesn't support .htaccess files, while LiteSpeed does. Even though you could still use NGINX as a reverse proxy infront of Apache). Furthermore you should definitely use a PHP operation code cacher, such as XCache and set the cache size to 64-128MB RAM. You also have to note that PHP by far isn't the only factor for fast serving of dynamic websites - MySQLd optimization is also crucial.
     
    infinitnet, Nov 21, 2013 IP