answersLogoWhite

0


Best Answer

The benefits of running PHP-CGI are:

*

* It is more secure. The PHP runs as your user rather than dhapache. That means you can put your database passwords in a file readable only by you and your php scripts can still access it!

* It is more flexible. Because of security concerns when running PHP as an Apache module (which means it runs as our dhapache user), we have disabled a number of commands with the non-CGI PHP. This will cause installation problems with certain popular PHP scripts (such as Gallery) if you choose to run PHP not as a CGI!

* It's just as fast as running PHP as an Apache module, and we include more default libraries.

There are a FEW VERY MINOR drawbacks to running PHP-CGI. They are:

*

* Custom 404 pages won't work for .php files with PHP-CGI. Or will they? See n74's comment below!

* Variables in the URL which are not regular ?foo=bar variables won't work without using mod_rewrite (http://httpd.apache.org/docs/mod/mod_rewrite.html) (example.com/blah.php/username/info/variable).

* Custom php directives in .htaccess files (php_include_dir /home/user;/home/user/example_dir) won't work.

* The $_SERVER['SCRIPT_NAME'] variable will return the php.cgi binary rather than the name of your script

* Persistant database connections will not work. PHP's mysql_pconnect() function will just open a new connection because it can't find a persistant one.

If one of those is a show-stopper for you, you can easily switch to running PHP as an Apache module and not CGI, but be prepared for a bunch of potential security and ease-of-use issues! If you don't know what any of these drawbacks mean, you're fine just using the default setting of PHP-CGI and not worrying about anything!

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between PHP and CGI?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

What is the difference between single quotes and double quotes?

in programming, single quotes are for characters, and double quotes are for string, but in php, javascript, html, css i don't see any difference between the two.


What is the difference between single quotes and double quotes in PHP?

There's not too much of a difference. Most people prefer using double quotes because of the fact that you can do this: <?php $var2 = "Look at {$var1}!"; ?> which you can't do the {} thing with single quotes. You would have to do <?php $var = 'Look at '.$var1.'!'; ?>


What is the difference between simple php and core php?

The terms "simple PHP" and "core PHP" are not commonly used in the web development community, but based on the context, we can provide an explanation of what they might refer to: Simple PHP: "Simple PHP" is a vague term that could refer to using basic PHP syntax and features without incorporating any advanced frameworks or libraries. In this context, "simple PHP" typically means writing PHP code without relying on additional tools or external dependencies. It implies a straightforward and minimalistic approach to PHP development. Core PHP: "Core PHP" refers to the fundamental and essential features of the PHP programming language itself. Core PHP includes the core functions, language constructs, and syntax provided by PHP without the use of any external libraries or frameworks. It involves writing PHP code in its purest form, utilizing the features and functionalities offered by the PHP language without any additional abstractions. In summary, "simple PHP" suggests a minimalistic approach to PHP development, while "core PHP" focuses on utilizing the essential features and syntax of the PHP language itself without relying on external dependencies. It's worth noting that both terms are not widely used, and their exact definitions may vary depending on the context and the individuals using them.


What is the difference between echo and print in PHP?

Print always returns a value of true, but echo doesn't. echo also has a short cut syntax meaning you can immediately follow the php tags by an equals sign and it will echo the result like in the example shown below: <?=$hello?>


Differences between cgi and servlet?

CGI creates process for each client call where as servlet creates process for the first time and then uses thread for each client.

Related questions

What is cgi and non cgi sites?

difference between cgi and non cgi sites


Can you run PHP 3 and 4 on the same server?

Yes, you can, provided that you run PHP as CGI.


Difference between apache and PHP?

Apache is a web server. PHP is a scripting language.


How do you install PHP as a CGI?

The PHP website has a comprehensive online manual that can explain most aspects of PHP, including its installation. See the related links for a constantly-updated PHP installation guide.


How do you test a Briggs and stratton coil?

One of these should help (from Briggs & Stratton's online knowledgebase) http://faqs.custhelp.com/cgi-bin/faqs.cfg/php/enduser/std_adp.php?p_faqid=3761 http://faqs.custhelp.com/cgi-bin/faqs.cfg/php/enduser/std_adp.php?p_faqid=3428 http://faqs.custhelp.com/cgi-bin/faqs.cfg/php/enduser/std_adp.php?p_faqid=3438


How do you set up a hit counter?

Using either CGI or PHP and a MYSQL table.


What are the different technologies available to make webpage dynamic?

CGI,asp.net,PHP,JSP


What are the capabilities of PHP?

PHP is a server-side scripting language capable of most anything other CGI languages can accomplish.Such as,Collecting form dataDynamic page contentCookie management


What is the difference between PHP and struts?

STRUTs is a framework of technology of java based on JSP/Java Servlets PHP is another server scripting language


What is the server used to run PHP in Windows?

One of the Windows Server operating systems. PHP can be installed with Microsoft's IIS web server as an ISAPI filter, or you can install the WAMP server under Windows that contains the Apache web server, the PHP interpreter, and mySQL. There are others as well, such as the Xitami web server, etc., that work equally well with PHP under windows.


How many PHP-based websites are there?

Nearly all websites have some sort of PHP backend, although a large number use other scripts as well -- Perl, Python, ASP, CGI.


What is the difference between Korean and Siberian Ginseng?

Different types of Ginseng: http://www.rxlist.com/cgi/alt/ginseng.htm