Add another PHP website to your WordPress Farm

add another PHP website to your WordPress Farm

You can quickly add another PHP website to your WordPress Farm if you have the need. For my Local WordPress development environment, I came across the need to add another PHP website for another project.

wordpress

I have already installed a local WordPress environment using Bitnami WordPress stack. From there, I eventually needed to add a separate vanilla PHP website. I needed to add another PHP website to my WordPress Farm. Adding the source files to my machine only rendered the HTML/CSS as expected, but you need to do a few minor tweaks to get Apache to handle the PHP files.

Let me show you how you can have WordPress and a vanilla PHP site on the same box.

 

Step 1 – Add your source file to an appropriate location

It honestly doesn’t matter where you save your source file for the PHP website. But for this guide, I’ll save my source file in the same neighborhood as my WordPress files to keep it easy to find.

Add your PHP website files to a location that you’re comfortable with. I created a new folder called WWW and stored it within my Apache Bitnami install:

C:\Bitnami\wordpress-4.4.1-0\apps\WWW

Notice that my WordPress and PHPMyAdmin files are in neighboring locations. This is OK for now.

add_PHP_location

 

Upload your PHP site and files to your new folder. Now we need to tell Apache Bitnami to play nice with other PHP website/projects.

 

Step 2 – Update your VHost file for Bitnami

Bitnami takes over and controls the routing of your files and data for PHP. We need to add a few lines to the Bitnami configuration file to tell it that you have a new website that would like you use PHP.

Lets go ahead and update the Bitnami VHost files. If you are using the default 4.4.1-0 WordPress install they are located here:

C:\Bitnami\wordpress-4.4.1-0\apache2\conf\bitnami\bitnami-apps-vhosts.conf

Add the DocumentRoot and Directory to the bitnami-apps-vhosts.config file to allow your website to be handled by PHP.

The ServerName property is important as well. This will be used in your browsers address bar to access your PHP site after you’ve updated your Host File.

**Change the port number to match your own installation. My port number is 81 for my PHP install.

<VirtualHost *:81>
 ServerAdmin xx
 DocumentRoot "C:\Bitnami\wordpress-4.4.1-0\apps\WWW"
 ServerName Reunion
 <Directory "C:\Bitnami\wordpress-4.4.1-0\apps\WWW">
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Require all granted
 </Directory>
 ErrorLog "C:\Bitnami\wordpress-4.4.1-0\apps\error_log.log"
 CustomLog "C:\Bitnami\wordpress-4.4.1-0\apps\common_log.log" common
</VirtualHost>

The ErrorLog and CustomLog are optional and will help you troubleshoot any problems you might have with your new PHP Virtual Host.

Now we should configured your computer to access your PHP site easily and quickly.

 

Step 3 – Update your computer hosts file

Your computers Host File translates the IP address of locations to a friendly and easy web address name. We are going to modify the Host File to allow you to access your new website easier than typing in the longer IP address + port combo.

Your Host File is located here:

C:\Windows\System32\drivers\etc

Open the file named hosts within Notepad or another text editor.

Update your Host File to include the address of the IP address of your local host (mine is 127.0.0.1) with a paired host name (I chose “reunion”).

**The Host Name is important and should match the same value as the ServerName property from your bitnami-apps-vhosts.config file. This is what routes your content correctly.

# localhost name resolution is handled within DNS itself.
 127.0.0.1 localhost
 ::1 localhost
 127.0.0.1 Reunion
 ::1 Reunion

Save the Host File with the changes you have done. You now have told Apache to add another PHP website to your WordPress Farm.

Now lets ensure that everything has taken and configured correctly. We need to restart the Apache service and flush the DNS afer all the changes are done.

 

Step 4 – Restart Refresh Recycle

Open the Bitnami Stack control pane on your machine. This is used to start, stop, or configure the Apache server or MySQL Database. You can also manage some of your Bitnami installs. It is an application that can be accessed from your Start menu.

Start > All Programs > Bitnami WordPress Stack > Bitnami WordPress Stack Manager Tool

bitnami_config_panel

 

Select the Apache Web Server then click “Restart” to cycle the Apache server.

Open a new Windows CMD prompt in Administrator Mode. In your Start menu, you can right click on the CMD prompt icon and ‘Run as administrator’ We will be flushing the DNS to ensure that your web address bar will go to to new Virtual Host location.

Type the command

ipconfig /flushdns

windows_cmd_dns_flush

 

Your DNS is flushed and the Apache server has been restarted. You should now be able to access your new website and resources by typing in the appropriate name + port # cobo in the address bar.

 

Conclusion

The new website can be accessed with a browser on the machine you have the source files located on. The website should also be able to act upon the PHP files that you’ve developed.

You can add as many Virtual Hosts as you’d like, but make sure you use the same port # that your Apache Bitnami install is located on.

My sites new local address looks like this:

add_PHP

 

If you’re having trouble with your new host name address, try restarting the Apache service and flushing the DNS again. The browsers also tends to cache the old information and wont appear right away.

 

Resources

One thought on “Add another PHP website to your WordPress Farm

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.