View Full Version : The PHP CGI cannot be accessed directly.

08-31-2004, 09:57 AM
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security (http://php.net/security.cgi-bin).

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page (http://php.net/install.windows).

I Need Help! I keep getting this DARN Message. I have installed/uninstalled/reinstalled PHP. I was able to get the test screen for PHP to open 1 time.

I am running Windows 2003 Server Enterprise w/ IIS 6 with PHP 5.
I am hosting this from my house. I am just trying to learn how to mak PHP run.
I have used the search button I have searched on Google. I have added the line cgi.force_redirect = 0 to my php.ini

I am about at wits end. I am a noob with web pages but I understand computers.


Thanks in Advance


08-31-2004, 11:50 AM
Suggestion: Don't use the auto-installer for PHP. While you'd think it would be easier, it sometimes has a lot of issues and makes things harder to get working. Download the full zip package from php.net and follow the instructions on how to install manually. My other suggestion would be to ditch IIS and use Apache, but that's just my personal preference.

08-31-2004, 11:06 PM
While I know that Apache is better. I use IIS on a daily basis for work so I understand some of it.

I have tried the manual process of installation of PHP.

Thanks for the advice. I think that my problem is something simple like permissions/locations of files but I am not sure.

Thanks again..


09-01-2004, 08:05 AM
Which way are you trying to run PHP? Using the php.exe, or the dll?

12-06-2004, 06:16 PM
Here is the way that I recommend clients using my software setup iis with php (not this was formulated for iis 5)

Manual Installation
Use the following steps to install PHP manually.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Locate the file php-4.3.4-Win32.zip that is part of the install files.<o:p></o:p>

Note the PHP ZIP file unzips and creates a folder based on the PHP release you downloaded. For example PHP release version 4.2.3 would unzip to the following folder <CODE>C:\php4.2.3-Win32</CODE>. To make future upgrades of your PHP installation easier, I recommend that you rename the installation folder to <CODE>C:\php\</CODE>. For this example, I will refer to the <CODE>C:\php\</CODE> folder. <o:p></o:p>

After installation of the files go to <CODE>C:\PHP\SAPI\ and copy PHP4ISAPI.dll to the folder c:\PHP\.</CODE><o:p></o:p>
Open the Internet <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:PersonName>Service</st1:PersonName>s Manager for IIS web server for your selected web server and website. (Start > Programs > Administrative Tools > Internet <st1:PersonName>Service</st1:PersonName>s Manager) and right clickon the desired website.
click Properties in the dialog box, select the ISAPI Filters tab, and select Add. <o:p></o:p>

In Filter Name, add the name of the ISAPI filter. (For this article, I entered: “PHP”.) <o:p></o:p>
In the Executable field, either use Browse or type the path to <CODE>C:\PHP\PHP4ISAPI.dll </CODE>
You should see the following: <o:p></o:p>

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape id=_x0000_i1025 style="WIDTH: 249pt; HEIGHT: 122.25pt" type="#_x0000_t75"><v:imagedata o:title=\"PHP1\" src="file:///C:DOCUME~1AndrewLOCALS~1Tempmsohtml11clip_image00 1.gif"></v:imagedata></v:shape><o:p></o:p>

Figure 3. The Filter Properties dialog box. Your settings should appear as shown.<o:p></o:p>

Click the OK button and select the Home Directory tab and the Configuration button, this will put you in a screen titled “Application Configuration”.<o:p></o:p>

Make sure that the Add Mappings Tab is selected.<o:p></o:p>
Click the Add button.<o:p></o:p>
In the Executable, use Browse or type the path to your PHP folder and the PHP4ISAPI.dll file (for this article, it is <CODE>C:\PHP\PHP4ISAPI.dll</CODE>). <o:p></o:p>
In the Extension type, enter the file extension that the server should use to refer to PHP scripts (this is most commonly the .php extension). <o:p></o:p>

You should see the following:<o:p></o:p>

<v:shape id=_x0000_i1027 style="WIDTH: 321.75pt; HEIGHT: 182.25pt" type="#_x0000_t75"><v:imagedata o:title=\"PHP2\" src="file:///C:DOCUME~1AndrewLOCALS~1Tempmsohtml11clip_image00 2.gif"></v:imagedata></v:shape><o:p></o:p>

Figure 4. The Add/Edit Application Extension Mapping dialog box. Your settings should appear as shown.<o:p></o:p>

Click OK, Apply, and OK to complete the settings. <o:p></o:p>
Stop and restart the web server. To do this, use the <st1:PersonName>Service</st1:PersonName>s utility in Control Panel within Administrative Tools (Start > Programs > Administrative Tools > <st1:PersonName>Service</st1:PersonName>s or Start > Settings > Control Panel > Administrative Tools > <st1:PersonName>Service</st1:PersonName>s). Then right click the IIS Admin <st1:PersonName>Service</st1:PersonName> and select Restart. You may also use the Command console to start/stop the web server, as follows: <o:p></o:p>
To stop the web sever enter: <CODE>Net stop iisadmin</CODE> <o:p></o:p>
To restart the web server enter: <CODE>Net start w3svc</CODE> <o:p></o:p>

When the web service has restarted, open the ISAPI tab as described in steps 2 and 3 above. <o:p></o:p>
Ensure that the ISAPI has loaded correctly. The ISAPI should be green, not red; red indicates that the ISAPI has failed to load. If the ISAPI has not loaded correctly, ensure that your paths to the ISAPI files are correct and that you copied the DLL files into the correct locations. If the ISAPI loads correctly, you are ready to test your PHP installation.<o:p></o:p>
Testing Your PHP Installation
To test your installation.<o:p></o:p>

Open your browser and type the path to your website plus info.php<o:p></o:p>

<o:p> </o:p>

in the example install above