I’m trying to set up a CentOS 6 server with virtualmin GPL. Installation went fine, creating virtual servers works, ftp is ok, mail works, etc… Unfortunately, php scripts in virtual servers fail and result in a 500 error.
If I try with an info.php file in /var/www/html/ and open the url for the file (https) it works. If I put the info.php on one of the virtual servers I created, I get the error…
Apache error log says:
[Sun Sep 11 20:45:43 2011] [warn] [client 84.195.182.194] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Sep 11 20:45:43 2011] [error] [client 84.195.182.194] Premature end of script headers: info.php
When I put the php execution mode on mod_php, the scripts work, but I don’t really want to do that and I would like to get it working with fast cgi.
Can someone help me out or point me in the right direction? I’ve been looking at apache configuration, suexec setup, mod_fcgid setup, but I can’t find something wrong…
Since this is the initial setup of a VPS I have the luxury to start all over agains so that’s what I did… I went back to a fresh install of Centos 6, installed perl and then virtualmin GPL (on my previous attempt I installed apache, mysql, php, dovecot, etc… before launching the virtualmin install script, this time I had the script install everything).
Virtualmin installation went flawless but unfortunately, I’m still having the same errors. In mod_php mode everything works but mod_fcgid is still not working.
Mmm, that’s pretty strange! The FCGID and CGI modes would typically work out of the box.
How are you uploading your files for the website to the server… are you by chance uploading them as root? If so, you may be seeing problems do to permission issues.
All files were uploaded through FTP by login in with the virtual server owner’s user. I created an info.php file as root in one of the virtual servers but I did a chmod (755) and chown to the VS owner’s user of that file so permissions are ok.
And indeed, I would consider this installation as ‘out of the box’, unless there’s something special about the Centos 6 VPS image my hosting company provided. As far as I can tell the image is a basic server Centos install without extra packages. I only installed did yum install perl and then ran the virtualmin script. I’ve attached a txt file with the result of yum list installed to this message. Maybe this can help?
All files were uploaded through FTP by login in with the virtual server owner’s user. I created an info.php file as root in one of the virtual servers but I did a chmod (755) and chown to the VS owner’s user of that file so permissions are ok.
And indeed, I would consider this installation as ‘out of the box’, unless there’s something special about the Centos 6 VPS image my hosting company provided. As far as I can tell the image is a basic server Centos install without extra packages. I only installed did yum install perl and then ran the virtualmin script. I’ve attached a txt file with the result of yum list installed to this message. Maybe this can help?
Don’t know if this is important, but there is another permission error I encountered earlier today… When I try to install Squirrelmail through the virtualmin script I get:
Configuration program failed : /config/conf.pl: /usr/bin/env: bad interpreter: Permission denied
No idea if this is related… Anyway, squirrelmail is not that important as usermin works great.
The fopen error only shows in cgi mode. In fcgid it’s:
[Mon Sep 12 20:25:53 2011] [warn] [client 84.195.182.194] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Sep 12 20:25:53 2011] [error] [client 84.195.182.194] Premature end of script headers: info.php
Well, I was puzzled by that at first too, though I realized that since it works in mod_php, any of the log entries could have been generated while the site was in the mod_php mode.
Anyhow, all that output looks good – that’s how things should be on a default setup.
What does the command “mount” show?
Also, I don’t imagine this will make a difference… but just to be super-sure, what if you create a file named “test.php” in your domain’s public_html folder, and put this in it:
<?php phpinfo(); ?>
If you set your domain to use the CGI execution mode, do you get the same error when calling the above file?
All the log entries posted here were base on a test with a phpinfo file
I get log entries in all modes (in apache error and access logs).
Mount returns:
/dev/xvda2 on / type ext3 (rw,grpquota,errors=remount-ro,usrquota)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)