PDA

View Full Version : php is faster than cgi?


ardarvin
2-20-06, 02:37 PM
Hey all, noob question here:

My website seems to run quite slow on Powweb (slower than my previous host), especially when it comes to CGI scripts (like my ikonboard forum). Would it be better to switch my forum to a PHP based forum? Any recommendations?

-ardarvin
www.buildering.net

stevel
2-20-06, 03:40 PM
Um, PHP is CGI. CGI is not any particular language, it applies to any "program" which runs in response to a web request. The program can be in any language supported by the server.

I don't think there's any significant difference in speed between PHP and Perl, the other common choice for CGI. I would venture to guess that whatever slowness issues you have they are not related to the programming language used. Much more important is the efficiency of the script itself, the number of database accesses and the number of images loaded for each page. Ikonboard is not noted for being particularly fast.

korik110
2-20-06, 04:05 PM
I'm using phpnuke for my site and phpbb for my messageboard and everything is painfully slow. I have multiple forum members complaining about how slow the page loads, how long it takes to reply, etc. I certainly expect things to be slow at times, but this is almost always. I would love to know if there's anything that can be done to speed things up a bit.

extras
2-20-06, 04:10 PM
PHP is one of the slowest among poplular script languages.
But you can write slow script in any language....

ardarvin
2-20-06, 05:11 PM
I asked a friend about the difference between PHP and Perl/CGI, and this is what he said:

"php typically is compiled into apache, so the parser is loaded into memory. with cgi, it loads an instance of the parser on each request, thus the slowdown."

Does this hold true for the powweb servers?

stevel
2-20-06, 07:05 PM
Again, for slow forums, the speed of the language is the last thing you should look at. If your forum is loaded with frills that cause multiple SQL requests, that can slow things down. (Frills such as birthdays, who's online, etc.)

My PHP-driven osCommerce site is quite fast (when PowWeb's servers are behaving.)

extras
2-21-06, 10:55 AM
PHP runs as CGI on PowWeb servers.
Running PHP as mod_php (Apache module) isn't safe for shared hosting.
(Some hosts still use this insecure setup for shared hosting accounts, though ...)

avuong
2-21-06, 11:04 AM
PHP runs as CGI on PowWeb servers.
Running PHP as mod_php (Apache module) isn't safe for shared hosting.
(Some hosts still use this insecure setup for shared hosting accounts, though ...)
No wonder! Now I understand why there is a delay in processing the PHP script. Thanks for the clarification.

extras
2-21-06, 11:26 AM
Simple php scripts run pretty fast on PowWeb, normally.

If it's slow, maybe it's doing something slow, such as including many mnay files,
doing slow MySQL queries, doing remote include, generating images, and so on.