简体   繁体   中英

Is there suPHP alternative?

I recently installed Ubuntu 16.04 and found out that suPHP is deprecated....

Is there any alternative way to setup the same thing like running php script as with each user's privilege?

I tried some directions using fastcgi, fcgi, fpm. But I'm not quite sure what are those for.

Thank you in advance!

I successfully configured PHP7 with Apache2 using ruid2 mod to run .php scripts as owner of the file.

https://github.com/mind04/mod-ruid2

It's available as a ubuntu package:

$ apt-get install `libapache2-mod-ruid2`

and enable it by $ a2enmod ruid2

Proceed with standard configuration for PHP and mod_userdir. After everything is set up and PHP is working in your user directories. Add RMODE stat to you directory declaration in userdir.conf :

<IfModule mod_userdir.c>
  UserDir public_html
  UserDir disabled root

  <Directory /home/*/public_html>
    RMode stat
    AllowOverride All
    Options MultiViews SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
      Require all granted
    </Limit>
    <LimitExcept GET POST OPTIONS>
      Require all denied
    </LimitExcept>
  </Directory>
</IfModule>

After that all your scripts will run as the owner of the file.

There are some more options and security pitfalls about this solution (ruid2 looks like is non maintained for a few years as well as suPHP) but it works for me as suPHP mod package is not supported in Ubuntu 16.04.1 LTS anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM