How to run PHP as CGI with Suexec

How to run PHP as CGI with Suexec

PhP is a server side script that is loaded into a server and generates the pages. CGI is utilized by replacing a SSI directive tag in HTML. When a page is loaded in the browser the server reads that directive and run the script file, which is replaced by given tag. If you are running PHP as CGI it means that you are telling your server about the destination of your PHP file and server executes that file each time when this page is requested. When every time a page is delivered in the browser, PHP reads the php.ini and configure its settings. Running php as CGI is more secure than DOS, because server controls the access to the coded library.

Steps to Run PHP as CGI:

Step 1: If you want to run php as CGI you need to configure the httd.conf first.

Step 2: To enable Apache to run php enable.

Step 3: Run this command: a2enmod actions.

Step 4: Configuration files of CGI can be found in: /etc/PHP4/CGI/PHP.ini

Step 5: Edit this file according to your requirement.

Step 6: After this restart the Apache.

Mostly we prefer mod-php to run php with HTTP server. It makes running php easy. But it is suitable only for one or two sites on the server, but in a large environment running php as CGI is better to avoid security risks. SuPHP is practically exactly is the same as SuExec. You need to specify it for php

By running PHP as CGI enhances the stability. So if you have security questions in your mind then I will recommend you to run php as CGI.

Main advantage to run it as CGI is you may run any executable code from the server and can write in C language, because most of programs uses standard input variables.

Enabling CGI:

Step 1: Go to Main>Service> Configure Php and SuExec.

Step 2: Set PHP4 handler to CGI.

Step 3: Set Apache SuExec to ON.

Step 4: And save new on new configuration link.
Author
Jaishree
Views
2,326
First release
Last update
Rating
0.00 star(s) 0 ratings
Top