- Download PHP for Windows. I prefer to use 7.4.x (current release - 12), so I downloaded the latest VC15 x64 Thread Safe package. I downloaded the .zip file version of the VC15 x64 Thread Safe edition, under the PHP 7.4 heading.
- Expand the zip file into the path
d:\php7
. - Configure PHP to run correctly on your system:
- In the
d:\php7
folder, rename the filephp.ini-development
tophp.ini
. - Edit the
php.ini
file in a text editor. - Change the following settings in the file and save the file:
1. Uncomment the line that reads;extension_dir = "ext"
(remove the;
so the line is justextension_dir = "ext"
).
2. In the section where there are a bunch ofextension=
lines, uncomment the following lines:- extension=php_gd2.dll
- extension=php_curl.dll
- extension=php_mbstring.dll
- extension=php_openssl.dll
- extension=php_pdo_mysql.dll
- extension=php_pdo_sqlite.dll
- extension=php_sockets.dll
- extension=mysqli
- Add
d:\php7
to your Windows system path - Open PowerShell or another terminal emulator (I generally prefer cmder), and type in
php -v
to verify PHP is working.
1 | PS C:\Users\myuser> php -v |
Configure PHP as an Apache module
Edit httpd.conf
,add index.php as a default file name:
1 | DirectoryIndex index.php index.html |
At the bottom of the file, add the following lines (change the PHP file locations if necessary):
1 | # PHP7 module |
Save the configuration file and test it from the command line (Start > Run > cmd):
1 | httpd -t |