From ArchWiki
(Redirected from Suphp)

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Many style violations. (Discuss in Talk: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.

Tip: With suPHP you are able, for example, to manage php applications in user's home directories without worry about permissions problems (when creating directories, files or uploads)


Install suPHP from the Arch User Repository: suphpAUR


To activate mod_suphp for the appropriate Virtual Hosts add a line like in your /etc/http/conf/http.conf file:

LoadModule suphp_module modules/

To use suPHP to parse PHP-Files you must add also this:

 AddType application/x-httpd-php .php

Then, for actually turn on mod_suphp add this line:

 suPHP_Engine on

Finally, you have to specify at least one suPHP_AddHandler directive, because mod_suphp by default handles no mime-type.

suPHP_AddHandler application/x-httpd-php

Finally your suPHP installation is complete. Before using it you need to restart httpd.service.

Note: If these changes are made in global Apache-configuration file, this will activate mod_suphp for all Virtual Hosts..

Additional information

Please note, that running mod_suphp and mod_php concurrently should be avoided. The same applies to CGI scripts which are run with webserver privileges.

suPHP should only be used if you are using no CGI scripts or if all CGI scripts are run using suExec.

Warning: If you use suPHP module instead of mod_php (php-apache) one, you will not be able to use phpMyadmin and some other applications because incompatibilities with php-cgi interpeter.

suPHP and mod_php

In order to use suPHP along side mod_php (for use phpMyAdmin for instance). The only way to go is configure suPHP and mod_php in differents Virtual Hosts or Directories.

suPHP in user directories

The following instructions intent to show how to configure suPHP just to work in users public_html directories and mod_php for everything else.

First of all, you need to change the suPHP handler name to avoid confilcts with php_module. Change this line in /etc/suphp/suphp.conf

;Handler for php-scripts

Add or modify this line in your /etc/http/conf/http.conf file:

LoadModule suphp_module modules/

Then, in order to set the suPHP module for user directories, add this to your /etc/http/conf/extra/http-userdir.conf file:

<Directory "/home/*/public_html">
    DirectoryIndex index.php index.html
    suPHP_Engine on
    AddHandler application/x-httpd-suphp .php
    suPHP_AddHandler application/x-httpd-suphp

Finally you need to restart httpd.service.

See also

  • MySQL - Article for MySQL
  • LAMP - Guide to setting up Apache, MySQL, and PHP.
  • PhpMyAdmin - Web frontend for MySQL typically found in LAMP environments
  • Adminer - A full-featured database management tool which is available for MySQL, PostgreSQL, SQLite, MS SQL and Oracle
  • XAMPP - Self contained web-server that supports PHP, Perl, and MySQL
  • mod_perl - Apache + Perl