I am trying to get suexec working with PHP on Debian Stretch (Apache 2.4.25).
I have the Debian package's default set of modules loaded plus cgid and php7.0.
This is the VirtualHost block I'm using on my test system:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
SuexecUserGroup testuser testuser
</VirtualHost>
This works correctly with a simple perl script in /var/www/cgi-bin that prints the process's UID. The script prints 1000, verifying that suexec is working. I also get the expected line in suexec.log:
[2017-07-28 11:54:27]: uid: (1000/testuser) gid: (1000/testuser) cmd: moo.cgi
However, when I use a similar PHP script, suexec is never called and the script runs as the Apache user.
How can I get suexec to work with PHP scripts?