CGI wrapper

Sorry to make yet another post but I actually take care of 3 different Virtualmin servers right now and this is about my own server this time where I am trying to set up WHMCS. I decided to just use it, if I can get it to actually work anyway, until I have time to make my own.

So heres the sitch. Virtualmin Pro Centos 5.4 with VM bleeding edge repos. I am using WHMCS on a subdomain hosting.mydomain.com. I don’t know if that matters. Its a top level virtual server anyway so I don’t think it does.

I switched it to CGI wrapper because it apparently can’t run in FCGId because when adding a new server it loses connection or something and causes things to not work properly. I think it messed something up a little actually. I created a ticket on WHMCS but I don’t know if they can even help as much as you might be able to since it may be the way Virtualmin is switching between FCGId and CGI wrapper. Or maybe its just some bug in WHMCS I don’t know.

Anyway in the logs I get something that translates to this:

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the manual page for CGI security.
For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.
Premature end of script headers: php5.cgi

I managed to clean it up from what it originally was so its a little more readable. It has a somewhat relevant link to here http://php.net/security.cgi-bin and another to a windows cgi install manual or something.

I tried playing around with the Apache settings and php.ini settings and adding stuff to .htaccess but nothing I tried did anything. So do you need more info? Have you had this problem before? I am lost so I hope someone can help me make it work.

Thanks =)

Ryan

I discovered some info that may or not be useful in getting any help.

If I browse to /cart.php, the links at the top such as Extra for example links to /cart.php?gid=2

However when I switch to CGI wrapper mode that link becomes /cgi-bin/php5.cgi?gid=2

It might be related to the new PHP version you’re using… versions beginning at 5.2.10 act differently in the way some variables get set, and not all software works correctly.

In $HOME/etc/php.ini, try setting “cgi.fix_pathinfo=0”. Right now, it’s likely either commented out, or set to 1.

-Eric

Genius! It might be indeed. I didn’t have that line in my php.ini at all. I added it, switched to CGI wrapper. Everything seems to work ok now. A server was successfully created. Now I just have to figure out how to properly use this thing better. Thanks for your help =)

I struggled with the same thing after the php upgrade That was indeed the fix…

Howdy,

You have “cgi.fix_pathinfo=0” set in $HOME/etc/php.ini, correct?

You’d want that in your user’s php.ini rather than the system-wide php.ini located in /etc.

-Eric

This worked for me, make sure you edit the php.ini for each virtual host.

yes Adrey, thats it, thank you much.

Does my new servers are going to have this option fixed or I will have to change it every time i create a new one?

thanks again

To correct that issue for new accounts – make sure that setting is enabled in your php.ini files located in /etc. That file is copied to new Virtual Servers when they’re created.

-Eric