Web Hosting Talk







View Full Version : PHP as CGI / as Apache Module


trader7702
06-08-2004, 03:15 PM
I have been reading around on PHP installations and wanted to get a bit of a consensus on how PHP is normally installed.

It would seem, if its installed as CGI, then is must be given executable permissions, and you have to add a tag similar to:

#!/usr/bin/php4

at the top of each script.

So my guess is, PHP is usually installed as an apache module as apposed to CGI? Or is there a work around for this that I have not come across yet?

So, in my eyes, the only reason to install PHP as CGI, is if you want to execute PHP for other purposes then hosting them for web access?

I apologize if this seems like such a noob question, but I just want to make sure I am understanding what I am reading and I am on the right path.

Thanks,

T7702

bombino
06-08-2004, 04:03 PM
Your assumptions are basically correct. Most installations provide PHP as an Apache module, some hosts provide strictly CGI access.

It is completely possible to install PHP both ways.

trader7702
06-08-2004, 04:27 PM
Thanks. Glad I am understanding this ok.

One question I dont understad yet and havnt seen it in my reading as of yet... For the hosts that use PHP in CGI mode, if it requires you to tack on that path at the top of each script, plus set execute permissions on everything... Dosnt it make it a pain in the butt for people to install most scripts? Or is there a way to work around this snag?

Or is it fairly uncommon from a host to do this on a server setup to host many clients?

Thanks, T7702

daejuanj
06-08-2004, 05:07 PM
Well, the most popular way to have PHP run as a CGI mod, is to use php-suexec. www.localhost.nl

You will not have to place that code at the top of the pages. As for permissions, i would believe so. For special things. (uploading, editing files, etc..)

For my $0.02, I really don't care much for PHP as a CGI, it will cause a few problems, a bit slow, and if you want to keep your server safe, you would either disable certain functions, or have PHP in safe mode.

Read this
http://www.webhostingtalk.com/showthread.php?threadid=277411

trader7702
06-08-2004, 05:49 PM
Thanks for the input.

I did notice that ove the last couple days, what functions to disable in PHP has come up a few times. I have taken note on what to disable.

I think I'm all squared away on the differences between the two. Thanks to the two of you for your comments on the subject.

T7702

daejuanj
06-08-2004, 05:53 PM
Originally posted by trader7702
Thanks for the input.

I did notice that ove the last couple days, what functions to disable in PHP has come up a few times. I have taken note on what to disable.

I think I'm all squared away on the differences between the two. Thanks to the two of you for your comments on the subject.

T7702
Sure, no problem. Always glad to help. :cool: