Archive for the 'Windows' Category

Increase fastCgi / PHP activityTimeout in IIS7

When your have installed PHP with the Microsoft web platform installer PHP is installed in C:\Program Files (x86)\PHP\v5.2.
When your PHP script runs longer than 10 minutes (600 seconds) you will get an 500 Internal server error.
To fix this issue you will need to increase the fastCgi activityTimeout in IIS7.
After Googling around i found a solutions, but because the web platform installer installs PHP in a path with spaces in it all examples failed.
I Googled some more and after a while i combined 2 solutions and got it to work.

Start a command promt and go to this folder:
c:\Windows\System32\inetsrv

Execute this command to see the current settings:

C:\Windows\System32\inetsrv>appcmd list config -section:system.webServer/fastCgi

Output will be something like this:

<system.webServer>
<fastCgi>
<application fullPath="C:\Program Files (x86)\PHP\v5.2\php-cgi.exe" monitorChangesTo="php.ini" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:\Program Files (x86)\PHP\v5.2" />
</environmentVariables>
</application>
</fastCgi>
</system.webServer>

To change the timeout to 1 hour (3600 seconds) execute the following command:

C:\Windows\System32\inetsrv>appcmd set config -section:system.webServer/fastCgi "-[fullPath='C:\Program Files (x86)\PHP\v5.2\php-cgi.exe'].activityTimeout:3600"

Not the use of double and single quotes to specify the correct parameters.
After you run this command you will see this output:

Applied configuration changes to section "system.webServer/fastCgi" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

After running the list config command again the output now looks like this:

<system.webServer>
<fastCgi>
<application fullPath="C:\Program Files (x86)\PHP\v5.2\php-cgi.exe" monitorChangesTo="php.ini" activityTimeout="3600" requestTimeout="600" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:\Program Files (x86)\PHP\v5.2" />
</environmentVariables>
</application>
</fastCgi>
</system.webServer>

As you can see the activityTimeout is now increased.
Restart your IIS service and your good to go.

2 Comments »

IE7 max tabindex problem #microsoft #fail

It took me an hour to debug some jquery in IE7. I was making a tab-navigation. When you click a tab it hides the content of the other tabs and shows the content of the clicked tab. Quite easy with jquery right? In all browsers except IE7 (I banned IE6 a long time ago..)

One of the tabs had a tabindex of 99999.
I added an alerts to display the value of tabindex attribute…
IE7 seems to have a max tabindex value of 16959!

Why? Only Bill Gates knows why….

1 Comment »

FastCGI process exceeded configured activity timeout

I found the solution here: http://forums.iis.net/t/1076662.aspx

Here is how to set the configuration with IIS 7.0:

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath=’C:\php\php-cgi.exe’].activityTimeout:600

You need to change the ‘C:\php\php-cgi.exe’ to the actual location PHP that you registered with IIS.

If you want to make double-check that the configuration worked properly, you can check it like this:

%windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgi

No Comments »

IIS7 Impersonate PHP Fast-CGI as local user

The problem i had that i had to talk to a dll through COM on a windows server in PHP.
I needed to run the site as another user than the standard IURS.
I tried setting the identity of the application pool, no success.

Finaly i found the solution;

The (default) website advanced settings page has the option to specify the Physical Path Credentials.
I set this to a regular system account, and checked within PHP with:

echo get_current_user();

Everything worked!

No Comments »

Use a drive letter for a directory path

This is just a reminder for myself as i just cannot seem to remeber any features of old scool DOS. *NIX is more my thing 🙂
Thank god i have a college named whizzrd 🙂

C:\>subst P: C:\Projects

Remove by:

C:\>subst P: /D

No Comments »