Here I am giving a step by step example to install PHP 7.3 on Windows 10. But before installing PHP you should install Apache Web Server and to know how to install Apache Web Server on Windows 10, please check the following link Install Apache on Windows 10.
Steps to Install PHP 7.3 on Windows 10 PC
Click on the following link to download PHP 7.3 for Windows and choose the VC15 x64 Thread Safe or VC15 x86 Thread Safe version.
Now extract the ZIP file to a folder, for example, F:\php73.
Open the folder F:\php73 and locate the file php.ini-development and rename it to php.ini.
In the php.ini file, find and modify the extension_dir and set as the following: (Note: change the folder name to your PHP installation folder)
extension_dir = "F:/php73/ext"
Uncomment the following lines to enable.
extension=curl
extension=gd2
extension=mbstring
extension=mysql
extension=pdo_mysql
extension=xmlrpc
Add F:\php73 to the PATH variable in Windows by clicking on the My Computer > Properties > Advanced System Settings > Environment Variables as shown in the below image:
Configure Apache Web Server for PHP 7.3
Open the CONF folder in Apache Web Server installation folder and open the httpd.conf file. Then find and modify the DirectoryIndex as shown below:
DirectoryIndex index.php index
Add the following lines to the httpd.conf file:
PHPIniDir "F:/php73"
AddHandler application/x-httpd-php .php
LoadModule php7_module "F:/php73/php7apache2_4.dll"
Now restart the Apache server and test the PHP file. Create a PHP file and add the following line and save it as index.php in the htdocs folder in Apache installation directory.
<?php phpinfo(); ?>
Now double click the file to test. The output is as shown in the featured image of this article.
Hi i tried following your guide and i keep getting this output in windows shell when i input
php -v
heres the output
php : The term 'php' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ php -v
+ ~~~
+ CategoryInfo : ObjectNotFound: (php:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
and here is my php.ini file code to show that i put everything in correctly, at least the chunks that are important.
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "C:/PHP7/"
;
;extension=bz2
extension=curl
;extension=ffi
;extension=ftp
;extension=fileinfo
extension=gd2
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
extension=mbstring
;extension=exif ; Must be after mbstring as it depends on it
;extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp
;extension=soap
extension=sockets
;extension=sodium
;extension=sqlite3
;extension=tidy
;extension=xmlrpc
;extension=xsl
The error you mentioned above is used to occurred, when system PATH variable is not set.
So please double check if you set the path variable correctly.