Dj Techblog

A blog on web development

Ad section

Install and configure Php7 on apache http server manually in windows 10

Last modified on Oct 31, 2020
Install Php7 on apache http server manually in windows 10

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 C:\php

Step 2: Configure the php.ini file

Now, you need to set the directory in which the loadable extensions (modules) reside. For this you need to 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.

windows path variable setting for php7

Step 4: Configure Apache httpd file to load php module.

Go to the conf directory of Apache server and find the httpd.conf file. It is the main configuration file where all server settings are stored as directive. It is read every time the server starts.

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

Go to htdocs directory of apache server which is home to all your project websites. Create a index.php file in this directory,
        <?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.
Published on on Oct 12, 2020
Ad section

Intro

Debabratta Jena

I mainly write about HTML5, CSS3, Javascript, Angular JS, Ajax, PHP, Mysql, On page SEO, Google Ads, Tag manager, Universal Analytics, Google My Business, SERP, Apache server configuration etc, Yoga is my passion.

Reach to me in the contact us form below

Follow me on

Contact us

Subscribe

Tags

Php HTML5 Javascript CSS Ajax Angular JS Google My bisiness Listing Google tag Manager Google Universal Analytics Search Engine Optimization On page SEO Off page SEO Google Marketing platform Digital Marketing Google Ads Mysql Apache Server

Ad section