php5 doesnt work - fastcgi broken?

11 posts / 0 new
Last post
#1 Thu, 04/30/2009 - 11:28
buzink

php5 doesnt work - fastcgi broken?

I installed virtualmin on debian without problems using the install script. suexec seems to be configured fine (/home). everything works but php. when i point my browser to a php script in public_html it offers me to download it in stead of executing it.

Do i have to configure fastcgi? should I create a cgi-php5 wrapper somewhere. Or should this already be present? Should php work out of the box?

Thu, 04/30/2009 - 12:12
andreychek

Are you using the Pro or GPL version of Virtualmin?

FastCGI should work fine out of the box for the Pro version, there's some setup involved for that on the GPL version, as described here:

http://www.virtualmin.com/forums/virtualmin/convert-php-sites-to-use-mod...

Sun, 06/07/2009 - 07:53 (Reply to #2)
buzink

thanks, but i don't have the option 'System Settings -> Server Templates -> Default Settings -> Apache Website -> Default PHP execution mode' that is described in the forum topic you linked to. I use GPL version.

This is what the Apache Website settings page looks like (the suexec is set to yes, but I tried also with no. no effect):

Directives and settings for new websites
ServerName ${DOM} ServerAlias www.${DOM} DocumentRoot ${HOME}/public_html ErrorLog /var/log/virtualmin/${DOM}_error_log CustomLog /var/log/virtualmin/${DOM}_access_log combined ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory ${HOME}/public_html> Options -Indexes IncludesNOEXEC FollowSymLinks allow from all AllowOverride All </Directory> <Directory ${HOME}/cgi-bin> allow from all </Directory>

Automatically add appropriate SuExec directive? Yes No
Write logs via program?
(Handles missing log directory) Yes No
Add Apache user to Unix group for new servers? No
Yes, find Apache user automatically
Yes, Apache user is
Users' website subdirectory to create Default (public_html)
Directory under home
(Must match DocumentRoot above)
Permissions on website subdirectory
Subdirectory for Webalizer statistics Default (public_html/stats)
Directory under public_html
Directory under home
Password-protect statistics? Yes No
Allow editing of Webalizer schedule? Yes No
Create alias websites by Creating Redirect virtual host
Creating permanent Redirect virtual host
Creating ProxyPass virtual host
Adding ServerAlias to parent
Port number for virtual hosts
Port number for SSL virtual hosts
Configure Webmin to use same SSL cert for IP? Yes No
Configure Usermin to use same SSL cert for IP? Yes No
Redirect webmail.domain to Usermin? Yes No
URL for webmail redirect Use domain name
Redirect admin.domain to Virtualmin? Yes No
URL for admin redirect Use domain name
Template Webalizer configuration Global config Selected file
Disabled website HTML Virtualmin default Entered below ..
Disabled website URL None (local HTML) Redirect to

Sun, 06/07/2009 - 07:53 (Reply to #3)
buzink

thanks, but i don't have the option 'System Settings -> Server Templates -> Default Settings -> Apache Website -> Default PHP execution mode' that is described in the forum topic you linked to. I use GPL version.

This is what the Apache Website settings page looks like (the suexec is set to yes, but I tried also with no. no effect):

Directives and settings for new websites
ServerName ${DOM} ServerAlias www.${DOM} DocumentRoot ${HOME}/public_html ErrorLog /var/log/virtualmin/${DOM}_error_log CustomLog /var/log/virtualmin/${DOM}_access_log combined ScriptAlias /cgi-bin/ ${HOME}/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory ${HOME}/public_html> Options -Indexes IncludesNOEXEC FollowSymLinks allow from all AllowOverride All </Directory> <Directory ${HOME}/cgi-bin> allow from all </Directory>

Automatically add appropriate SuExec directive? Yes No
Write logs via program?
(Handles missing log directory) Yes No
Add Apache user to Unix group for new servers? No
Yes, find Apache user automatically
Yes, Apache user is
Users' website subdirectory to create Default (public_html)
Directory under home
(Must match DocumentRoot above)
Permissions on website subdirectory
Subdirectory for Webalizer statistics Default (public_html/stats)
Directory under public_html
Directory under home
Password-protect statistics? Yes No
Allow editing of Webalizer schedule? Yes No
Create alias websites by Creating Redirect virtual host
Creating permanent Redirect virtual host
Creating ProxyPass virtual host
Adding ServerAlias to parent
Port number for virtual hosts
Port number for SSL virtual hosts
Configure Webmin to use same SSL cert for IP? Yes No
Configure Usermin to use same SSL cert for IP? Yes No
Redirect webmail.domain to Usermin? Yes No
URL for webmail redirect Use domain name
Redirect admin.domain to Virtualmin? Yes No
URL for admin redirect Use domain name
Template Webalizer configuration Global config Selected file
Disabled website HTML Virtualmin default Entered below ..
Disabled website URL None (local HTML) Redirect to

Sun, 06/07/2009 - 07:53 (Reply to #4)
buzink

thanks. I did all that now. The php-script doesn't get downloaded anymore, but i get a 403 forbidden error now. i couldn't find a suexec log, so i created one, but it stays empty.

the wrapper fcgi-bin/php5.fcgi is owned by the user and is executable and not writable by g/o, i copied php.ini from /etc/php5/apache2 to user/etc/php5. I added 2 lines to apache directives. Still 403. Any suggestions?

-rwsr-xr-x 1 root root 10244 Oct 12 2007 /usr/lib/apache2/suexec

SuexecUserGroup "#1001" "#1002"
ServerName robertgrab.com
ServerAlias www.robertgrab.com webmail.robertgrab.com admin.robertgrab.com lists.robertgrab.com server3.robertgrab.com
DocumentRoot /home/grab/public_html
ErrorLog /var/log/virtualmin/robertgrab.com_error_log
CustomLog /var/log/virtualmin/robertgrab.com_access_log combined
ScriptAlias /cgi-bin/ /home/grab/cgi-bin/
ScriptAlias /awstats /home/grab/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/grab/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /home/grab/fcgi-bin/php5.fcgi .php
</Directory>
<Directory /home/grab/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.robertgrab.com
RewriteRule ^(.*) https://robertgrab.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.robertgrab.com
RewriteRule ^(.*) https://robertgrab.com:10000/ [R]
Alias /dav /home/grab/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName robertgrab.com
AuthUserFile /home/grab/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
</Location>
<Files awstats.pl>
AuthName "robertgrab.com statistics"
AuthType Basic
AuthUserFile /home/grab/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://robertgrab.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://robertgrab.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2

Sun, 06/07/2009 - 07:53 (Reply to #5)
buzink

thanks. I did all that now. The php-script doesn't get downloaded anymore, but i get a 403 forbidden error now. i couldn't find a suexec log, so i created one, but it stays empty.

the wrapper fcgi-bin/php5.fcgi is owned by the user and is executable and not writable by g/o, i copied php.ini from /etc/php5/apache2 to user/etc/php5. I added 2 lines to apache directives. Still 403. Any suggestions?

-rwsr-xr-x 1 root root 10244 Oct 12 2007 /usr/lib/apache2/suexec

SuexecUserGroup "#1001" "#1002"
ServerName robertgrab.com
ServerAlias www.robertgrab.com webmail.robertgrab.com admin.robertgrab.com lists.robertgrab.com server3.robertgrab.com
DocumentRoot /home/grab/public_html
ErrorLog /var/log/virtualmin/robertgrab.com_error_log
CustomLog /var/log/virtualmin/robertgrab.com_access_log combined
ScriptAlias /cgi-bin/ /home/grab/cgi-bin/
ScriptAlias /awstats /home/grab/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/grab/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /home/grab/fcgi-bin/php5.fcgi .php
</Directory>
<Directory /home/grab/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.robertgrab.com
RewriteRule ^(.*) https://robertgrab.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.robertgrab.com
RewriteRule ^(.*) https://robertgrab.com:10000/ [R]
Alias /dav /home/grab/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName robertgrab.com
AuthUserFile /home/grab/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
</Location>
<Files awstats.pl>
AuthName "robertgrab.com statistics"
AuthType Basic
AuthUserFile /home/grab/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://robertgrab.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://robertgrab.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2

Thu, 04/30/2009 - 14:17
Joe
Joe's picture

Keep reading. The very next message in that thread goes on to cover all of the steps involved in setting up FastCGI, Suexec, and multiple versions of PHP in Virtualmin GPL.

--

Check out the forum guidelines!

Fri, 05/01/2009 - 00:37 (Reply to #7)
buzink

I must say that I find it strange that the install.sh script doesn't create a server setup with working php. Obviously anyone installing lamp would want php to work. Why doesn't the script put these files is skel and add the directives to the default apache template?

If it is difficult, maybe the script could at least warn and point to a help-page about this? Or at the very least you should tell users this on the page about the install script. (And tell them also that mysql-php link is not installed).

I know its GPL and for free, but an install script suggests that is installs things in a way that it works. It'll frustrate users when things don't work after installing, unless they are warned and offered a solution for that.

Apart from this minor critical note: thanks for virtualmin and thanks for helping out!

Fri, 05/01/2009 - 03:47 (Reply to #8)
Joe
Joe's picture

I think you're misunderstanding the point of that mode of operation. The FastCGI+suexec is one way to run PHP applications. mod_php is another. Virtualmin GPL only supports mod_php, out of the box. FastCGI+Suexec takes a small amount of configuration. The latter is a feature that is included, by default, in Virtualmin Professional (along with UI support for user configuration of php.ini, version selection, and a few other niceties).

In short, this is one of the benefits of Virtualmin Professional, and because it is built into the Install Scripts part of the code, it would not be easy to provide in GPL...but we do provide documentation for folks who want to use the same mode in GPL. I kinda thought we were going the extra mile. I never thought of it as short-changing folks.

--

Check out the forum guidelines!

Fri, 05/01/2009 - 04:50 (Reply to #9)
buzink

In that case I must say that i misunderstood things. I wanted to install virtualmin and looked for the easiest way to do that. That seemed to be the install.sh script. After installation i got an error about suexec. I read about it in the forums and decided to install virtualmin apache version with the right path compiled in suexec. The error was solved but php didn't work. It took me many hours of searching and trying before I got it to work. Thanks to your great help it didn't took me weeks.

If I understand you correctly, in stead of installing the custom apache version of virtualmin and do the configuring, I could have ignored the error and installed mod-apache-php5 instead without much configuring (except for maybe activating mapache-php5 module in webmin configuration).

I understand your point and i hope I haven't offended you, but I still think some kind of warning on the install.sh page would be good: "After running the script you should install mysql-php5 yourself and you should choose the way apache runs php scripts. You have two options, 1. installing mod-php5 and 2. installing and configuring suexec/fastcgi. You can find documentation about that here."

Fri, 05/01/2009 - 00:26
buzink

solved! Just added ExecCGI to this line in apache virtualhost directive:

Options -Indexes IncludesNOEXEC FollowSymLinks

became

Options -Indexes IncludesNOEXEC ExecCGI FollowSymLinks

Topic locked