Why learn PHP
Php is by far the most used server side scripting language. There are lots of languages which can be used for back end on the web but php is specially designed only for this. Most of the server runs php, because it is compact and powerful. Though, new languages has emerged as more powerful but php still tops the list.
Also read, Apache server setup in windows 10
If you have already installed apache server on your machine and struggling to install php on apache server, this tutorial will help you to manually install PHP 7 on apache http server in windows 10.
Why install PHP manually
You can also install php, apache and mysql as a bundled package using XAMP but, in that case you will not understand the core details of php and how it is configured. Installing these applications separately and manually will give you a nice grip on the topic.
Here is the step by step process:Step 1: Download and extract the php zip file
Download the latest version of php7 from php.net.
Extract the file and save it in a directory in the C drive. In my case it is
Step 2: Configure the php.ini file
Search for the php.ini-development file. Open this file in notepad and search for “extension_dir” inside the file.
Remove the initial semi colon and set its value, the directory in which all extensions are stored. In this case it is
extension_dir = "C:\php\ext"
Enable extensions, which is suitable for most of the application. You can change it according to your need.
extension=curl extension=gd2 extension=mbstring extension=mysql extension=pdo_mysql extensino=xmlrpc
After you have done this changes, save this file as php.ini. This is the main configuration file which is read every time php starts.
Step 3: Add C:\php to the path of environmental variable.
Now, windows need to find php files present in
C:\php. Go to Advanced Settings, Environmental variable,
System Variable tab, add
C:\php as a new Path.
Step 4: Configure Apache httpd file to load php module.
Search for DirectoryIndex and redefine it as
DirectoryIndex index.php index.html
Now, you need to tell apache server to load php module. For this add this line at the end of the httpd.conf file.
# PHP7 module LoadModule php7_module "C:\php\php7apache2_4.dll" AddType application/x-httpd-php .php PHPIniDir "C:\php
Step 5: Create a index.php file for testing
<?php echo "PHP 7 installtion on Apache server successful"; phpinfo(); ?>
Now, restart the apache server, and type. localhost:80 in your browser. You will see the default index.php file in browser.