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:
- Open your terminal with root permission
- Type this command:
apt-get install libapache2-mod-suphp
- Wait until it is finished, and you are done.
See how it in action:
httpv://www.youtube.com/watch?v=7iMA9KSHe3E
Manuall installation for other Linux distributions:
- Open your terminal with root permission
- 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
- Install suPHP prerequisite:
yum install php-cli httpd-devel #For CentOS and Fedora #OR apt-get install php5-cgi apache2-prefork-dev #For Debian and Ubuntu
- 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 make install
- Add this to httpd.conf:
LoadModule suphp_module modules/mod_suphp.so
- 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.
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
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
make install
Run Ubuntu 20.04, CentOS7
Thanks: https://webhostinghero.org/how-to-install-suphp-on-centos-7