Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have VPS with kloxo installed on it. Inside the Web Server config section there is a possibility to select between 6 options of PHP Type which are as follow:

  1. suphp
  2. suphp_worker
  3. suphp_event
  4. mod_php
  5. mod_php_ruid2
  6. mod_php_itk

Now my question is, what is difference here? And which one is better to run PHP under?

P.S. when I select suphp I get an Internal Server error (500).

share|improve this question

closed as not constructive by ThatGraemeGuy, Tom O'Connor, Ward, voretaq7 Nov 13 '12 at 23:53

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Have you done any research? Google? Anything? Seriously, we'd love to help, but you need to put some effort in. Particularly if you're asking us "what's best" (a question we can't answer for you because we don't know your environment...) –  voretaq7 Nov 13 '12 at 23:53
    
@voretaq7 Yes, I have done my research but I needed a concrete answer so I thought maybe some people would like to help and serverfault is where to seek it. I think you all are getting way above your heads. You could've simply asked me to put more details instead of closing down my question. Thanks for nothing. –  Hamed Momeni Nov 14 '12 at 8:51
    
If you feel your question was closed unfairly please open a discussion on Meta - I'm happy to reverse the closure if the community thinks I messed up. (Or you can take the criticism I offered, rework your question to be less subjective and show us the research effort you've put in, and get it reopened without having to grouse on Meta.) –  voretaq7 Nov 14 '12 at 16:17
add comment

1 Answer

up vote 2 down vote accepted

Those are not really "6 PHP Types", rather two PHP types, each running in 3 different Apache implementations.

suphp, suphp_worker and suphp_event

suPHP itself is a wrapper for PHP, running PHP under given user rights (eg differing from the rights Apache runs under) plus an Apache module (mod_suphp) which allows you to run suPHP - basically in a CGI mode. CGI mode simplified means, that each request passed through to PHP starts a new PHP (runtime) process. This is expensive, in terms of CPU usage, and slower compared to a persistent PHP runtime (~about 3-5 times, i'd guess).

I assume this first variant uses the Apache's prefork MPM, which is widely used and tested but rather slow, compared to other MPMs. Prefork does what it name implies: It forks a given amount of apache processes and holds them available for incoming requests.

The next (suphp_worker) uses the worker MPM instead. Worker is a mix of pre-spawned processes and threads, which is generally faster than prefork (for delivering static contents about twice) and uses less memory.

The last (suphp_event) seems to use suPHP + MPM event, which uses yet again another process/thread model than worker. From benchmarks i've seen, event and worker are about the same speed - the event MPM (at least using Apache 2.2, which your provider probably does) is marked as experimental.

mod_php, mod_php_ruid2 and mod_php_itk

This is a differnt kind of PHP handler implementation: Apache pre-starts a PHP runtime and passes incoming requests to it, spawning new processes as needed. This is considerable faster than suPHP but comes with the downside of having no user right separation: all the php processes run under the same rights as Apache itself.

The first variant probably uses the prefork MPM (described above) as mod_php is incompatible with the thread models from worker or event.

The second variant (mod_php_ruid2) seems to use the Apache module mod_ruid2 in addition, which allows you to run each Apache VirtualHost under differnt user rights - this includes PHP processes. It has a long list of incompabilities which you should consider.

The last variant (mod_php_itk) uses the third party ITK MPM for Apache, a fork of the Apache prefork MPM with the option run each VirtualHost under given user rights. It also gives you the ability to enforce additional limits (eg amount of clients) per VirtualHost.

Suggestion

If those are your only choice, and you are "alone" on your Machine (aka: you do not plan shared hosting) i would probably stick with good ol' mod_php.

If you are planing multiple websites you need to check with your priorities:

  • security over performance: go with suphp_worker. Both (worker MPM and suPHP) are widely tested and give you a good starting point for security. Performance for static files should be good, PHP not so much.
  • performance over security: Probably mod_php_ruid2, but only because i have bad experience with ITK

I do prefer using a third option, which uses FastCGI, giving you even more possibilities to separate rights and access priviliges - but this seems not to be offered.

share|improve this answer
    
Thank you for your comprehensive answer. I mainly serve my own websites on this VPS. About FastCGI, there is checkbox while adding clients which says Enable FastCGI. Does that mean I have it installed? –  Hamed Momeni Nov 13 '12 at 9:39
    
A big answer - unfortunately the stuff about mod_php is wrong - it doesn't start additional processes - the PHP interpreter runs in the same process/thread as apache. –  symcbean Nov 13 '12 at 12:29
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.