Welcome Guest ( Log In | Register )




Collapse

Top Submitters

· NickTheGreek (127)
·  (127)
· www.yourforum.gr (61)
· nickpar (20)
· Big (1)

Collapse

Random Tutorials

Can I recover lost text from a Microsoft Word document?

Tutorial name: Can I recover lost text from a Microsoft Word document?
Submitted by: nickpar


Collapse

Announcments


Welcome to Tutorial System!

Courtesy of www.gr8webservices.com & www.forumsandmore.com



Print this Tutorial 

DSO (mod_php) vs. CGI vs. suPHP vs. FastCGI

Tutorial Information
Name: DSO (mod_php) vs. CGI vs. suPHP vs. FastCGI
Submitter: NickTheGreek
Category: cPanel Tutorials
Submitted: 12 Nov 2012
Updated: 12 Nov 2012
Views: 461
Rating: This tutorial is unrated.
DSO (mod_php) vs. CGI vs. suPHP vs. FastCGI
View All Tutorials By This Member
View Discussion Topic
Description:
This is one of the most common topics that I see customers will ask about. As highly important as PHP handlers are, they often the least understood. They seem complicated, but its not too hard to understand. You don˘t have to know that exact science of how it all works, but one should learn the basics if you want to take your website seriously. Picking the right PHP handler for your website will give you the optimal speeds you want and maybe allow you to save some money by using a cheaper hosting package. So I invite you to take a few minutes and learn something new.
Tutorial Instructions
DSO (mod_php) vs. CGI vs. suPHP vs. FastCGI


# Updates:
#
02/12/12
– Added some more definitions
# 02/02/12 – Link clean up
# 12/30/11 – Added in link for ServInt blog
# 10/06/11 – better explanation for CGI with suEXEC

This is one of the most common topics that I see customers will ask about. As highly important as PHP handlers are, they often the least understood. They seem complicated, but its not too hard to understand. You don˘t have to know that exact science of how it all works, but one should learn the basics if you want to take your website seriously. Picking the right PHP handler for your website will give you the optimal speeds you want and maybe allow you to save some money by using a cheaper hosting package. So I invite you to take a few minutes and learn something new.
What are PHP handlers


In order to run a PHP site, the server must interpret the PHP codeand generate a page when visitors access the website. It interprets thecode based on which PHP library you are using, such as PHP 4 or PHP 5. APHP handler is what actually loads the libraries so that they can beused for interpretation. PHP handlers determine how PHP is loaded on theserver.

There are multiple different handlers that can be used forloading PHP: CGI, DSO, suPHP, & FastCGI. Each handler delivers thelibraries through different files and implementations. Each file andimplementation affects Apache˘s performance, because it determines howApache serves PHP.

It is essential for your server˘s performance that you select thehandler that fits your situation. Selecting the right handler is justas important as the PHP version itself. One handler is not necessarilyalways better than another; it depends on your unique setup.
  • Note: You may assign different PHP handlers to differentversions of PHP. For example, version 5 may be handled by CGI while PHP 4is handled by DSO.
How to change the handler


Changing the handler on cPanel is very easy to do and only takes seconds. Log into WHM and navigate to: Main >> ServiceConfiguration >> Configure PHP and SuExec

You simply select your PHP handler choice from the drop-down menu. Then hit “Save New Configuration”.
  • Note: If you do not see your desired choice in the drop-downmenu, it may need to be compiled on the server first. Run an “Easy Apache” to compile it.
List of PHP handlers

DSO (mod_php)


DSO is also known as mod_php. DSO stands for: Dynamic Shared Object. This is an older configuration but is generally considered the fastest handler. It runs PHP as an Apachemodule. This means that PHP scripts will run as the Apache user, whichis the user: ˇnobody˘.

DSO has two drawbacks. First, all files created by a PHP scriptwill have the ownership of ˇnobody˘. They will not be readable from the web. Websites that need to upload files through PHP will run into filepermission issues. This is common with WordPress users that upload filesthrough the WordPress interface or utilize the auto-update feature.These will fail with DSO.

The second drawback is a security issue. Created files will havethe ˇnobody˘ ownership. If a hacker finds an exploit in your PHP script,they could implement a file that has the same privileges as importantsystem files that are also owned by ˇnobody˘. This will give them theability to modify files outside of that user˘s account. This is really bad for anyone who does reselling or simply is hosting other person˘s sites. You would not one user to be able to affect another user. However, if there is only one account on the server (or if all the accounts are yours), then DSO may be right for you. The speeds benefits of DSO are unquestionable.

The preventative fix the hack issue is to always keep your site˘s software up to date. Check with your PHP script˘s developer to keep up on the new releases. If you are the only one being hosted on the server, this is easy to do as it˘s part of your webmaster duties already. However, if you˘re reselling, it would be unreasonable to expect all your user˘s to keep their software up to date. They simply may not be as diligent as you.

DSO˘s low CPU usage typically amounts in higher speeds and load times over most other handlers. It is also the default setting on most servers.
CGI


CGI stands for: Common Gateway Interface. The CGI handler will run PHP as a CGI module as opposed to an Apache module. CGI still runs PHP processes as the Apache ˇnobody˘ user. However, if you have suEXEC enabled, it will allow you to see the user that made the request.

The CGI method is intended as a fallback handler for when DSO is not available. According to cPanel˘s own documentation, this method is neither fast nor secure, regardless of whether or not suEXEC is enabled.

http://docs.cpanel.net/twiki/bin/view/AllD...MorePhphandlers
suPHP


suPHP stands for Single user PHP. suPHP also runs PHP as a CGI module instead of an Apache module. It differs from CGI in that PHP scripts that are called from the web will run under theuser that owns them, as opposed to ˇnobody˘. suPHP is typically thedefault handler and is recommended by cPanel for serving PHP because you will be able to see which user owns the account that is running the PHP script.

suPHP is beneficial in that if you are using a file upload tool on your site(such as an automatic updater or theme/plug-in installer for WordPress), the files will already have the right ownership &permissions. Uploading and other WordPress functions will not workwithout suPHP or FastCGI.

suPHP also offers a security advantage that any php script that isnot owned by the particular user (such as another account or root) willnot be executable. Also, files that have permissions set to worldwriteable will likewise be non-executable. This means that if oneaccount is compromised, the malicious scripts will not be able to infectother accounts.

The drawback is that suPHP generally runs a much higher CPU load.In addition, you CANNOT use an Opcode Cache (such as Xcache or APC)with suPHP. It is strongly recommend that you install a caching plug-in to supplement this ned. If you find that your server is still continually strugglingwith CPU usage, you will want to consider switching to DSO or FastCGI.

*If you DO switch to either suPHP or FastCGI, you will need to update the file permissions and ownership. See my other article for automatic fixperms on cPanel servers: http://boomshadow.net/tech/fixes/fixperms-script/
FastCGI


FastCGI (aka: mod_fcgid or FCGI) is a high performance variation of CGI. Ithas the security/ownership benefits of suPHP in that PHP scripts willrun as the actual cPanel user as opposed to ˇnobody˘. The differencewith FastCGI is that it can drastically save on CPU performance and givespeeds close to that of DSO. It can also be used with an opcode cacherlike eAccelerator or APC, which can help further speed the loading ofpages.

The drawback is FastCGI has a high memory usage. This is becauserather than creating the PHP process each time it is called, like suPHP,it keeps a persistent session open in the background. This is what letsit work with an opcode caching software.

If you like the security/ownership benefits of suPHP and you canafford a major increase in memory usage (meaning you already have a lowaverage memory usage), you may wish to consider using FastCGI.

Comparison Graph




If you are using WordPress to run your site, please consider the following:
  • Functions that require uploading files to the server (such asAuto-updates or Plug-in/Theme installation) will NOT work unless PHP isloaded as a CGI module. This means they will ONLY work with suPHP orFastCGI. This will ensure they are uploaded with the correct ownership& permissions.
  • CMS platforms such as WordPress will notoriously run a high CPU load. You will want to install a caching plug-in such as WP Super Cache,especially if you are running suPHP. If you find that your server isstill continually struggling with CPU usage, you may want to considerswitching to DSO or FastCGI.
Note about this article

[source]boomshadow.net/tech/php-handlers/[/source]
Comments
There have been no comments made as of yet. Why not be the first?



1 user(s) active
Active Users 1 guests, 0 members, 0 anonymous members
Sorted by Last Click
Quick Stats
Board Stats There have been a total of 244 tutorials in 6 categories and 0 sub-categories with 111843 views and 24 comments
The newest tutorial is How to Add “Move to” or “Copy to” to Windows 10˘s Context Menu by NickTheGreek

RSS Lo-Fi Version Time is now: 18th April 2024 - 02:59 AM
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More © 2005-2011.
InvisionGames - Your #1 Arcade Games Repository | AllSigs - Signatures for all | Rock Band + Guitar Hero = RockHero ! | The Remoters - Remote Assistance | FileMiners - You ask, We find