icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Apache or CGI

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old September 4th, 2005, 2:29 AM   #1 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,546 posts
Gave thanks: 70
Thanked 33 times
Question Apache or CGI

I know I could probably look this up...but I saw something about this somewhere and it's 1:30am and I'm lazy.

So, just a random curious question - what exactly is the difference between running PHP as CGI, as opposed to Apache? (I know Surpass runs it as Apache....see I do know some stuff!) I mean does it make PHP do other things, or not do things...or...what?
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 4th, 2005, 3:24 PM   #2 (permalink)
Surpass Fan
On a golden path...
 
Joined in Nov 2004
Lives in San Francisco
364 posts
Gave thanks: 0
Thanked 3 times
http://en.wikipedia.org/wiki/Common_Gateway_Interface

Basically, in CGI mode the web server calls a CGI script whenever the script's URL is requested. Each time the script is called, a new process is spawned and the php binary is run. CGI scripts can be in almost any language, with PHP being one of them. When the CGI script produces output, Apache sends it to the browser.

When Apache itself handles PHP, what is happening is .php scripts are being processed by Apache's mod_php. This allows better control over what's going on, as Apache itself is executing the scripts, not handing off the processing to some third party (as in CGI). I believe it's faster this way, as well, but don't quote me on that.
ghostcop is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks ghostcop for this great post!
ceo (November 4th, 2007)
Old September 4th, 2005, 4:28 PM   #3 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,546 posts
Gave thanks: 70
Thanked 33 times
Thanks for answering, ghostcop! This is truly fascinating to me - and I'm inclined to agree with it being faster on Apache.
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 4th, 2005, 5:06 PM   #4 (permalink)
Insanely
Super #1
 
Skipdawg's Avatar
 
Joined in Jul 2005
Lives in Northwest USA
4,154 posts
Gave thanks: 39
Thanked 78 times
Great question and answer. I was wondering about this a little myself. kewl
__________________
Skipdawg is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On