Wednesday, May 28, 2008

How to change default documents on IIS7 (Vista, Server 2008)

Using the appcmd command you can view, add and delete default documents in IIS configuration.

View:
C:\> %SystemRoot%\system32\inetsrv\appcmd list config /section:system.webServer/defaultDocument

Add:
C:\> %SystemRoot%\system32\inetsrv\appcmd set config /section:system.webServer/defaultDocument /+files.[value='index.php']

Remove:
C:\> %SystemRoot%\system32\inetsrv\appcmd set config /section:system.webServer/defaultDocument /-files.[value='index.php']

Friday, May 23, 2008

PHP as Apache module vs. PHP via Apache FastCGI

apachelounge.com members share very interesting results of their experiment with different PHP configurations.

Light blue line: httpd.exe processes Memory Usage
Dark blue line: all processes Memory Usage total
Fri-Sun : mod_fcgid
Mon-Tue : module with php from php.net (VC6)
Wed-Thu : module with self build php (VC9)
Fri : mod_fcgid



Link

Thursday, May 22, 2008

How to specify PHP.ini for IIS5.1 and IIS6 FastCGI

The specific PHP.ini can be specified in the "Arguments" IIS FastCGI configuration option as follows:

[Types]
php=PHP-5.2
[PHP-5.2]
ExePath=C:\path\to\php-cgi.exe
Arguments=-c C:\path\to\php.ini

You can open the FastCGI configuration file by opening Windows command prompt and executing the following command:

notepad C:\WINDOWS\system32\inetsrv\fcgiext.ini

Wednesday, May 21, 2008

Troubleshooting "Fatal error: Maximum execution time exceeded" in PHP

The "Fatal error: Maximum execution time of [some number] seconds exceeded in [php file name] on line [some number]" error message indicates that the called PHP script reach the time limit and was terminated by the PHP language engine. There are number of reasons for that and most common of them are:
  • Sending a lot of queries to a database.
  • Some particular database query requires a lot of time to complete.
  • Script has a lot of data to process.
  • Defect in script code.
If you are the script developer, you can profile it and fix bottlenecks. If you an administrator, you can try to increase PHP script time limit in PHP.ini by increasing the value of the max_execution_time option (in seconds) or call the set_time_limit function at the very top of the script in a PHP code block.

Examples:
  • PHP.INI: max_execution_time = 600
  • PHP script:
  • .htaccess: php_value max_execution_time 600