Time to discuss the recursive acronym, PHP!
So you'd like to know how to install PHP 7.0? Follow this short tutorial and you'll be on your way in no time!
Step 1. Download PHP 7.0.12
Head over to: http://www.php.net/downloads.php and under "Current Stable PHP 7.0.12" click on "Windows Downloads"
Under PHP 7.0 we will scroll to "VC14 x64 Thread Safe" and click "Zip" as seen in figure 2.1 below. The download will begin automatically.
We need the VC14 x64 version because that is the version of Apache that we installed in the previous tutorial. Thread safe refers to multi-thread capable builds whereas non thread safe refers to single thread only builds, this is why we picked the thread safe version.
 |
| Figure 2.1: PHP 7.0 download for VC14 x64 |
Step 2. Extract the download
Create a folder called "PHP in the root of the C: drive and extract the php download to that folder (Figure 2.2).
 |
| Figure 2.2: Created PHP folder in the root of the C: drive |
Step 3. Create php.ini
Once extracted open up the PHP folder and scroll down to php.ini, you'll see two options(Figure 2.3): php.ini-development & php.ini-production make a copy of php.ini-development and rename it php.ini then open it up in your text editor.
 |
| Figure 2.3: Extracted contents of PHP download |
Step 4. Configure php.ini
Make the following changes to php.ini:
- Change extension_dir to "C:/PHP/ext" ()
 |
| Figure 2.4 |
- Enable the following extensions: (To enable an extension remove the semi-colon)
 |
| Figure 2.5 |
Step 5. Add C:PHP to the environment path variable
Go to Control Panel and click System. Click Advanced and then Environment Variables. Scroll to the System variables list and click Path then Edit. Add ";C:php" to the end of the variable value line. Ensure you include the semi-colon!! You can now click "Ok" until you are back at the initial screen, restart the computer if prompted.
 |
| Figure 2.6 Adding PHP to the environment path variable |
Step 6: Configure PHP as an Apache module
Go to C:\Apache24\conf\httpd.conf and in the DirectoryIndex add index.php (Figure 2.7). At the top of the file add the content seen in figure 2.8 from there we can test if it is working by opening a command prompt, navigating to Apache24/bin and running the command "httpd -t", if there are no errors then you have configured PHP as an Apache module successfully.
 |
| Figure 2.7 Add index.php to the DirectoryIndex |
 |
| Figure 2.8 Add PHP 7 as an Apache module |
Step 7. Let's test it out!
In C:\Apache24\htdocs create a file called index.php and add the following code(Figure 2.9): <?php phpinfo(); ?>
 |
| Figure 2.9 Create an index.php file |
Go to: C:\Apache24\conf\extra and change the directory index of a virtual host to index.php (Figure 2.10)
 |
| Figure 2.10 Change the directory index to index.php |
Save all file changes, restart the Apache server and attempt to hit that virtual host, if successful you should see something similar to the output in Figure 2.11.
 |
| Figure 2.11 Output successfully loading index.php |
No comments:
Post a Comment