Reaching out to others! Free & Open Source Software, Kannada, L10n, L18n Data Science, Cloud Computing & more…

suPHP, mod_php and phpsuexec

linux, Product Info, QuickFix, Technical | 0 comments

What is suPHP?

suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.

Hey, I think I know about it. Isn’t it called as phpsuexec in Cpanel servers?

Not really, phpsuexec is now deprecated by Cpanel. where php used to be setup as cgi instead of apache module.

Then mod_php?

Its nothing but an apache module of php. When you process php scripts with mod_php files written by PHP are saved as the apache process (usually apache/apache user/nobody/group). So you need to assign 777 permission to the files and folders which needs write permission from PHP scripts. It means less security though its 25 – 30% faster than suPHP/phpsuexec. PHP safe mode is also not safe.

So, what is the permission required for the files if I choose to use suPHP?

PHP files can have perms of 640 as Files/folders written by PHP are written as user/group (no apache or other global user)

Is it is possible to continue using .htaccess to have custom php directives with suPHP?

No, Custom php.ini file can be used in your document root instead of .htaccess file.

Can I run both PHP4 and PHP5 with SuPHP?

Yes, You can run both PHP4 and PHP5 with suPHP at the same time. Earlier to run two different versions of PHP on servers, we used to compile one PHP version with mod_php and another one with phpsuexec. Now its not required.

Related Articles