[HowTo] Install suPHP On Ubuntu

suPHP is a tool for executing PHP scripts with the permissions of their owners. Along with the Apache module, mod _suphp it allow Apache to process php with the user permission. This will improve the security. With suPHP you can track which users use the most resources.

Follow the steps below to install suPHP on Ubuntu:

  1. Open your terminal with root permission
  2. Type this command:
    apt-get install libapache2-mod-suphp
  3. Wait until it is finished, and you are done.

See how it in action:

Manuall installation for other Linux distributions:

  1. Open your terminal with root permission
  2. Disable PHP5 module, you need to edit httpd.conf:
    vim /etc/httpd/conf/httpd.conf
    #note the location may be vary in different Linux distributions.

    Then disable PHP5 module

    #LoadModule php5_module modules/libphp5.so
  3. Install suPHP prerequisite:
    yum install php-cli httpd-devel #For CentOS and Fedora
    apt-get install php5-cgi apache2-prefork-dev #For Debian and Ubuntu
  4. Download and build suPHP:
    cd /tmp
    wget http://www.suphp.org/download/suphp-0.7.1.tar.gz
    tar xvfz suphp-0.7.1.tar.gz
    cd suphp-0.7.1/
    ./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=paranoid --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes
    make install
  5. Add this to httpd.conf:
    LoadModule suphp_module modules/mod_suphp.so
  6. Restart Apache:
    /etc/init.d/httpd restart #For CentOS and Fedora
    /etc/init.d/apache2 restart #For Debian and Ubuntu

That’s it, now when apache execute your php script it will execute as the user permissions.


  1. Well suPHP is a tool for executing PHP scripts with the permissions of their owners…Thanks for giving the steps in the post to install suPHP on Ubuntu…By following this we can install it..Thanks

  2. Andrey says:

    wget http://suphp.org/download/suphp-0.7.2.tar.gz
    tar zxvf suphp-0.7.2.tar.gz

    Use patch
    wget -O patchingsuphp.patch https://webhostinghero.org/downloads/php/suphp.patch
    patch -Np1 -d suphp-0.7.2 < patchingsuphp.patch
    cd suphp-0.7.2
    autoreconf -if

    ./configure –prefix=/usr/ –sysconfdir=/etc/ –with-apr=/usr/bin/apr-1-config –with-apache-user=apache –with-setid-mode=owner –with-logfile=/var/log/httpd/suphp_log
    make install

    Run Ubuntu 20.04, CentOS7

    Thanks: https://webhostinghero.org/how-to-install-suphp-on-centos-7

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.