PHP Tutorials

PHP Server

This complete tutorial takes you step by step on how to set up a server environment on your own computer...
1
An Introduction

In this tutorial you will learn how to step up your own server. This server will be comprised of Apache 1.3.5, PHP 4.2.0, and MySQL® 3.23.49. This tutorial will address the basic setup of a server on your own computer. This means the removal of hassles of dealing with the company that is running a remote web server. It will be easy to modify. You will have unlimited disk space, well at least as big as your hard drive is. =) Now that you know the advantages, it is time that I tell you what I used, and what you will need.

What I used

  • Windows® 2000 - NOTE that if you are using this you WILL NEED Administrative Privileges.
  • Apache 1.3.5 - I tried to use 2.0 but I could not get it work. I also feel that 1.3.5 is tried and true, so why mess with greatness.
  • MySQL® 3.23.49 - The newest version of MySQL® when I set up my server. MySQL® also the is the best PHP supported Database, and well love PHP don't we.
  • PHP 4.2.0 - The latest and greatest PHP release.
What you will need


Once you have downloaded all the programs you are ready to continue.
Microsoft, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries.
2
Your Own Server - Installing Apache

The first step is to download Apache. The link is if you want to download off of Apache.org, you can also download it off of the many mirrors that can be found on apache.org. Download the 1.3.24 version. Before you download it make sure that any other server software is removed.Once you have download the file, launch it, and proceed to the next step.

Once you have clicked on the executable, a screen should come up. Go ahead and click on next

Read the licence agreement and accept it if you agree to the terms.

The next screen invites you to read various items related to the software. When you are ready click on next.

Here is where the actual setup of Apache begins. For Network Domain put in localhost as for Server Name you want these both to be localhost because the server is running locally, on your computer. It doesn't matter what is in email field, just put in yours. No one will know it because it's just you.

Select the destination folder for the install and continue.

Once you are ready click on install.

If all went well you should be told the installation is complete. Now it is time to test the install of apache. Find the executable icon and run it. If the install works you should see a page saying that it works. If all is set and done, continue to the next page.

3
Your Own Server - Installing PHP

Of course, just like before the first step is to download the PHP software.

Once you have clicked on the executable, a screen should come up. Go ahead and click on next.

Read the licence agreement and accept it if you agree to the terms.

The next screen acts you which type of installation you require. Click standard and continue.

For the mail configuration enter localhost and your email address and continue.

Select Apache from the list of servers and continue.

Once you are ready click on install.

After the install is done you should get something that says you will have to manually configure apache to use php. Assuming you have a working Apache server installed, make sure that it is not running. Navigate to the httpd.conf file that is in the conf directory of your Apache install (or search for it). Now hit Ctrl + End if you see some like, this:

ScriptAlias /php/ "c:/php/"

AddType application/x-httpd-php .php .phtml

Action application/x-httpd-php "/php/php.exe"
you can skip this step. If you do not see that code, copy it and put it in this file and save. This code will only work if you used the default install folder when you installed PHP. The variables to change are "c:/php/" and "/php/php.exe" to point to your install location. Now that we have php installed, it is time to test it. Open up a text editor and type the code below:

<?php
phpinfo();
?>
Save it as phpinfo.php. Save in the htdocs directory in your Apache install directory (again you can search for the htdocs directory). You can create endless dir's and browse them. For Example E:\Program Files\Apache Group\Apache\htdocs\mydir\myfile.php could be accessed as http://localhost/mydir/myfile.php. Once you have that file saved. You will need to start the Server. Find the menu item "Start Apache in Console". After you have found it, launch it. You should get a window saying that Apache is running. Now go to a web browser and type in http://localhost/phpinfo.php. If you don't see anything, php is not installed correctly. If php is installed correctly, you will see a few large tables, displaying php's configuration. Congratulations! You are 1/2 done!

4
Your Own Server - Installing MySQL

Of course, just like before the first step is to download the MySQL software.

Once you have clicked on the executable, a screen should come up. Go ahead and click on next.

Read the licence agreement and accept it if you agree to the terms.

Just like before you should leave the default dir alone, so you will be able to follow along with me when I show you how to start and stop all the aspects of the server. Click next to continue.

Stay with the typical installation. Just like before, if you don't have admin privileges, the install will be faulty. After you click next, the install will begin. After the install has finished, move on to the next step.

Now you have to set up the root account. The root account is the absolute admin of the system, the highest possible. Click on Start > Run and type cmd to open up the command prompt. You are going to have to navigate to where MySQL® is installed. Type C: > Enter > cd mysql > Enter > cd bin > Enter. Now you have to tell setup the root settings. Type mysqladmin -uroot password InsertYourPasswordHere then hit enter

What is the point of having a database if you can't easily administer it! That is where phpMyAdmin comes into play. phpMyAdmin is a free piece of software written in PHP that makes the administration of a MySQL® or many other types of databases easy. You will want to download the latest version of phpMyAdmin. Save it in the htdocs folder. Once the download is complete unzip it. When it is done you should end up with a directory in the htdocs folder called phpMyAdmin-2.2.6 (or later version). To make it easier to access, rename it to phpMyAdmin. After you have renamed it, click on it and look for a file called config.inc, open it. This is where you set the configuration of phpMyAdmin. On yours there should be a few things missing. The $cfgPmaAbsoulteUrl and $cfgservers[$i]['password']. You will need to fill those in between the quotes. For the $cfgPmaAbsoulteUrl enter "http://localhost/phpMyAdmin/" if you followed my instructions to the letter. If you did not rename it or extracted to a different directory, put that in there. For the $cfgservers[$i]['password'] enter the password you entered when you were setting MySQL® in the set above. You can refer to the image for help. After you have put the right things in save the file

Now we want to test the install of MySQL®, PHP, phpMyAdmin, and Apache all at once. Start Apache in console like we did before. Now, you are going to need to start MySQL®. For myself I made a file that would start MySQL® for me. Open a text editor and type: start c:\mysql\bin\mysqld-nt.exe --standalone and save that as Start MySQL.bat once you have saved it, click it. A window should open and then close. MySQL® is now running on your computer. After MySQL® and Apache are started go to run again and type http://localhost/phpMyAdmin/index.php and if everything is installed correctly phpMyAdmin should so up. Congratulations! You are almost done! Now we have the easy part =)

5
Your Own Server - Finishing
Wow! We made it through the whole process. Now we want to simplify the whole process of controlling the server. I made a toolbar with all the things I needed. I made a new folder on the desktop and called it Server Folder and put all the stuff there. I made a new shortcut and gave it a value of http://localhost/ made a shortcut to the PHP Documentation page. The phpMyAdmin shortcut is set to http://localhost/phpMyAdmin/index.php. I made another shortcut to the htdocs folder. I moved the Start Apache in Console program menu item and moved it to the server folder. You can take the Start MySQL® file you made in the last page and move it to the new folder. After you have put all the desired things into that folder, right click on a blank space in stat menu task bar (where the program boxes lie) and select Toolbars > New Toolbar and navigate to the folder. Voila! Now all you have to do is click Start Apache in Console , Start MySQL®, and Localhost and you are done. No command line are anything! Pure Ease. I hope that this tutorial was easy to follow and effective. If you have any questions or comments email me at z-team@attbi.com or talk to me on neverside.com by username is Adman.
This tutorial was by Adman, brought to you by Robouk, please post any questions in the forum. Thank you.
BACK TO TUTORIALS