Install PHP on IIS:
- Download PHP for Windows:
- Download the latest PHP version from the official PHP for Windows.
- Extract the files to a directory, for example,
C:\PHP
.

Create directory
- On inetpub\wwwroot create your directory

Configure PHP with IIS:
- Open IIS Manager:
- Open IIS Manager (you can find it by searching in the Start menu or running
inetmgr
).
- Open IIS Manager (you can find it by searching in the Start menu or running
- Select Your Website:
- In the left panel (Connections), select your website.

- Configure Handler Mappings:
- In the middle panel (Features View), double-click on Handler Mappings.
- Click on Add Module Mapping… and configure the following:
- Request Path:
*.php
- Module:
FastCgiModule
- Executable: Browse and select
php-cgi.exe
in the directory where PHP is installed (e.g.,C:\PHP\php-cgi.exe
). - Name:
PHP_via_FastCGI
- Request Path:
- Click OK and confirm

Create a Test File:
- Create a file named
info.php
in your web directory with the following content:php
1 2 3 | <?php phpinfo(); ?> |
Access the Test File:
- go to
http://yoursite/GetComputerName/info.php

Sample php.ini
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ; PHP INI Configuration File ; Basic PHP Settings [PHP] engine = On short_open_tag = Off precision = 14 output_buffering = 4096 zlib.output_compression = Off implicit_flush = Off unserialize_callback_func = serialize_precision = 17 disable_functions = disable_classes = zend.enable_gc = On ; Timezone setting date.timezone = "Europe/Paris" ; Error Handling and Logging display_errors = On display_startup_errors = On log_errors = On error_log = syslog error_reporting = E_ALL track_errors = Off ; File Uploads file_uploads = On upload_max_filesize = 10M max_file_uploads = 20 ; Data Handling post_max_size = 10M auto_globals_jit = On ; Paths and Directories include_path = ".;C:\php\includes" ; Resource Limits max_execution_time = 30 max_input_time = 60 memory_limit = 128M ; Extensions extension_dir = "ext" ; Enable PDO and MySQL extensions extension=pdo_mysql ; Session Settings [Session] session.save_handler = files session.save_path = "C:\Windows\Temp" session.use_strict_mode = 0 session.use_cookies = 1 session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_secure = session.cookie_httponly = session.cookie_samesite = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.referer_check = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.sid_length = 26 session.trans_sid_tags = "a=href,area=href,frame=src,form=" ; cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. ; Uncomment it if you are running under CGI. cgi.force_redirect = 1 cgi.fix_pathinfo = 1 ; FastCGI settings fastcgi.impersonate = 1 fastcgi.logging = 0 ; Paths and Directories upload_tmp_dir = "C:\Windows\Temp" sys_temp_dir = "C:\Windows\Temp" ; Socket and Database Handling pdo_mysql.default_socket= ; Mail settings [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = me@example.com ; Xdebug configuration (if you use Xdebug) [XDebug] zend_extension = "C:\php\ext\php_xdebug.dll" xdebug.remote_enable = 1 xdebug.remote_autostart = 1 xdebug.remote_port = 9000 xdebug.remote_host = 127.0.0.1 xdebug.remote_handler = dbgp xdebug.remote_mode = req |
0 Comments