Forums / Installing on a Linux/Unix Server / Running PHP as CGI?

Running PHP as CGI?

Locked

Started by pixelpadre on 22 Dec 2008, 8:05 PM · Views: 3,417

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
22 Dec 2008, 8:05 PM
#1
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Running PHP as CGI?

Many hosts are running PHP as cgi. And now my host announced plans to do the same.

How will this effect me?

Do I need to do anything special?

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!

22 Dec 2008, 8:57 PM
#2
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Running PHP as CGI?

once your host makes the switch you will need to set all folders to 755 ( this means the images folders and all )
and all files need to go to 644 ( exception are the 2 configure.php files these need to be at 444 )

thats it

Zen cart PCI compliant Hosting

24 Dec 2008, 12:27 AM
#3
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Re: Running PHP as CGI?

what about httaccess?

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!

24 Dec 2008, 12:33 AM
#4
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Running PHP as CGI?

you will need to remove alll php over rides from your htaccess and put them in a php.ini

Zen cart PCI compliant Hosting

25 Dec 2008, 1:50 PM
#5
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Re: Running PHP as CGI?

i.e. ?

Merry Something

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!

25 Dec 2008, 2:53 PM
#6
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Running PHP as CGI?

register_globals on

this would not be able to be in the htaccess
would need to go into a custom php.ini

Zen cart PCI compliant Hosting

25 Dec 2008, 7:32 PM
#7
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Running PHP as CGI?

pixelpadre:

Many hosts are running PHP as cgi. And now my host announced plans to do the same.

How will this effect me?

Do I need to do anything special?
Special, no, but you should verify your site is still functional. Unless your site is static HTML pages then odds are it is going to break if certain things are not done.

These type upgrades/changes require 4 things regarding Hosting accounts. Three have been mentioned already by Merlin and the 4rth one is 'nobody' files.

Many popular scripts such as Joomla and Mambo use files with Ownership of 'nobody' and running PHP as CGI does not allow that. As they are not owned by you, the Hosting account Owner, they cannot be changed by you. Only through a special script or by Server 'root' can Ownership be changed.

In my opinion as a Hoster, it would make no sense to switch PHP to run as CGI without also doing all 4 steps mentioned at the Server level, along with advising all Clients affected of the upcoming change. Leaving it up to the Hosting Clients is not right and is just going to make a lot of people upset; when they find their site no longer works and don't know how to correct. I can only presume your Hoster has advised of when the PHP change will be made and, hopefully, will be doing all necessary changes as well.

The learning is in the doing.

Potent Products

25 Dec 2008, 7:40 PM
#8
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Running PHP as CGI?

Example of changes you could make after the PHP change, is with your .htaccess file.

**## public_html/.htaccess
php_flag session.use_trans_sid off
php_value register_globals off
**

change to

**## public_html/php.ini
session.use_trans_sid = off
register_globals = off
**

The learning is in the doing.

Potent Products

29 Dec 2008, 1:31 AM
#9
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Re: Running PHP as CGI?

OK, I did a fresh install. But I have a problem.

I can login to admin.

But

I get 500 error on main page.

Is there something minor here? Or do I have to do some serious digging.

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!

29 Dec 2008, 2:07 AM
#10
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Running PHP as CGI?

if you are getting a 500 error
1 owner and group are not set rignt ( call host )
2 you have a folder thats holding a php file in it set above 755 ( fix folder permissions

3 you have files that are set higher than 644 once again fix the permissions

Zen cart PCI compliant Hosting

29 Dec 2008, 3:13 PM
#11
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Running PHP as CGI?

We run Apache as a CGI and always have, and don't have any problems with it.

As already outlined it allows for better security with folders using permissions of 755 and not needing permissions of 777 and files not needing permissions higher than 644. You will get Internal Server Errors if you try to run files with permissions of 777. Perhaps this is what is happening with you?

As already said, some features previously controlled by .htaccess may now have to be done via a local php.ini file - but when running Apache as a CGI you may now also have your own local copy of php.ini which you can edit - without the need to create one yourself. This is the case on our servers.

Vger

29 Dec 2008, 9:58 PM
#12
yelow avatar

yelow

Zen Follower

Join Date:
Sep 2008
Posts:
115
Plugin Contributions:
0

Re: Running PHP as CGI?

Does PHP as CGI and .htaccess questions mean you're on Fasthosts?

<!-- just commenting -->
30 Dec 2008, 12:12 PM
#13
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Re: Running PHP as CGI?

every unix host i have contacted is now using cgi

h o s t g a t o r
m o c h a H o s t
B l u e H o s t
and (YUCK) my current host
I x w e b h o s t i n g

and numerous others I have contacted.

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!