With the apparent increase of interest in individuals desiring to install PHP and MySQL on computers running Windows operating systems, I thought it would be beneficial to provide a set of instructions to help make this process as easy as possible. In this article, I’ll be providing some basics of IIS installation and then move to the installation of PHP and MySQL.
Some essentials you will need to get started:
IIS (preferably IIS 5 or IIS 6)
The PHP windows installer file
The PHP binaries file
The MySQL Windows installation file
(links will be provided for the downloads shortly).
Optional:
phpMyAdmin
MySQL Administrator
Let’s get started. Since you are installing on a Windows computer, you will most likely be using IIS for a web server, however, it is not required. You must have some web server running however, and you are quite welcome to use Apache or another web server of your choice, however, since that falls outside the scope of this tutorial we will leave that discussion for another day.
Some things to know about IIS. IIS v5.1 is included with Windows 2000 Professional, and Windows XP Professional, but is not installed by default. (*note – IIS 5.1 is not included with XP Home edition and is not available as a stand alone download from Microsoft. If you are an XP Home user, you will need to look for an alternative web server solution.) Windows 2000 server includes IIS 5.1, and Windows 2003 server includes IIS 6.
If you haven’t already done so begin by installing IIS. To do this go to Control Panel | Add/Remove Programs | Add/Remove Windows Components. In the dialogue box that comes up, check the option for Internet Information Services(IIS) and click the “Details” button. Select any additional features that would like to have installed and click OK. Click OK again to begin the installation. This will install IIS and start the web server service automatically. You should not need to reboot. To test your installation open your web browser and type in http://localhost/ . This should bring up the default IIS page. If it does, your installation was a success and you can immediately get started on installing PHP.
It really shouldn’t matter whether you install PHP first or MySQL first. I’ve simply gotten into the habit of beginning with PHP, so that will be my next step. To get the files you will need, go to the download page at php.net . The most current release available for download at the time of this writing is 5.1.1. This release has worked just fine for me, so it’s the one I use. You will want to download both the PHP 5.1.1 zip package AND the PHP 5.1.1 installer. Unzip both files to a temporary location and run the setup installer. This will install PHP automatically. The default installation directory is C:\PHP and I would suggest to leave it at that, unless there is a specific reason you need to install it elsewhere. *note it is not recommended to install PHP in a directory that contains spaces such as c:\Program Files\PHP as it can cause some web servers to crash. Answer the questions as they are presented by the wizard. I recommend choosing the option to add PHP to the Windows PATH environment variable when that option is presented. If not you can manually add it later, but you really should include it. For a good article on Windows environment variables go here . When the installer completes you will have a basic installation of PHP. This works just fine, but it is recommended to add the additional libraries found in the PHP 5.1.1 zip package. Simply copy those files into the C:\PHP directory. The following files in this package are already installed with your PHP and there is no need to copy them install.txt, license.txt, php.exe and php4ts.dll.
To test your PHP installation copy the following into a file and save it as info.php in c:\Inetpub\wwwroot\ . (wwwroot is Windows IIS default website folder. Any of your web files will always go in there)
Code:
<?php phpinfo(); ?>
Then go to your web browser and type: http://localhost/info.php . If your installation was successful, this should display your PHP configuration information.
Now we can proceed to installing MySQL. Go to the MySQL download page here. . As of this writing the most current release is v5.0.16. Download the Windows(x86) file (the 33.6MB file). This is the full package and includes the installer. Unzip it to a temporary location and run the installer. For the most part, especially for someone doing this the first time, it’s easiest to use the standard installation. This will essentially configure all the basic things you need to have MySQL work. During the configuration you will be asked which port to use. The default port 3306 is usually fine, however if you know something else is already using that port, you can select another one. Your “super” user that will be created during the install is user “root”. Root is the chief administrative username and can do anything in MySQL. You can add other users later after you’re up and running, but root is going to be your main admin access. Remember the root password you use. If you lose or forget it, there is no way to access it, and you could find yourself unable to use MySQL. Complete the wizard. Now let’s test it to make sure it’s working. Go to Programs | MySQL | MySQL Server 5 | MySQL Command Line Client. This is a utility similar to DOS for managing MySQL. At the password prompt type in the password you entered and hit enter. If your server is working properly you should get something that looks like this:
Quote:
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.16-nt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
If you see that, your installation was successful. You can type quit or exit to close the Client.
Now there are some purists out there that probably swear by that command line client and use it exclusively for managing their server. However, for us spoiled Windows dummies that are used to “easy-to-use” GUI’s there is an alternative good tool for your server management - MySQL Administrator which can be downloaded from HERE . The installation is very straightforward. After it’s installed simply run it. For your logon the host would be localhost, the port would be the port you used when installing MySQL (default 3306) and the user would be root with the password you gave on installation. Since administering your MySQL server is beyond the scope of this article, we’ll leave that for another day, however, you’ll see very quickly the ease with which you can add users and create and manage your databases.
The last tool that I listed as optional, I actually couldn’t live without it, and that is phpMyAdmin which can be downloaded HERE . Simply unzip the contents to a temporary directory. Create a folder called phpMyAdmin in c:\Inetpub\wwwroot\ and copy your extracted phpMyAdmin download files in there. Then open config.default.php in an editor and edit the following as needed.
Make sure the port number here $cfg[’Servers’][$i][’port’] = ‘3306′; matches the port you used when installing MySQL. If you are going to only be using this as a development machine and it will not be connected to the internet or accessible from the internet use the following configuration for these three lines:
Code:
$cfg[’Servers’][$i][’auth_type’] = ‘config’; // Authentication method (config, http or cookie based)?
$cfg[’Servers’][$i][’user’] = ‘root’; // MySQL user
$cfg[’Servers’][$i][’password’] = ‘yourpassword’; // MySQL password (only needed
// with ‘config’ auth_type)
If this will be accessible from the web, you’ll most likely want to use HTTP authentication, in which case change config to http and leave user and password empty. Save the file as config.inc.php in your phpMyAdmin folder.
For some reason on a Windows machine, phpMyAdmin seems to want access to php_mbstring.dll . To solve this open c:\Windows\php.ini (or WINNT if Win2K) and find the following:
; Directory in which the loadable extensions (modules) reside.
extension_dir = “./’
Change that to
; Directory in which the loadable extensions (modules) reside.
extension_dir = “./extensions/”
Then scroll down to this line and uncomment it (remove the leading semi-colon)
extension=php_mbstring.dll
Now, in theory you should be able to go to http://localhost/phpMyAdmin/index.php and you should be working. “In Theory”. However, I’ve done four Windows installations on Win2K, XP and Windows 2003 Server machines, and this is where I always run into a snag. For some reason, there seems to be a bit of a problem with the MySQL authentication protocol that it doesn’t like.
Well, that was a bit lengthy, but if all went well, now you should be happily ready to start serving up PHP pages on your Windows computer. My turorial may not include every specific detail, nor will it answer every problem you might encounter. But it should get you to where you have a good installation.
If anyone has additional information, feel welcome to add it. Good luck with your install!
Whether you are an experienced web programmer or a complete novice attempting to provide data interactivity with your web site, MyQSL is an easy to use and free database solution that can allow you to store and configure data to be displayed on your web site.
The best way to create and manage a MySQL database is to download an open source (free) program called PhpMyAdmin. PHPMyAdmin allows you to manage all aspects of both your database structure and data from one easy to use interface. This tool is intended to handle the administration of MySQL over the Web.
This tool provides an interface that allows you to create and drop databases, create, drop, or alter tables, delete, edit, or add fields, execute any SQL statement, manage keys on fields, manage privileges, and import and export data into various formats. That sounds like a complicated set of activities, but the easy to use graphical tools make things quite simple and easy to understand. If you make a mistake, the software even provides instructions on where you made your error.
For a complete demo see: http://www.phpmyadmin.net/phpMyAdmin/ For documentation visit: http://www.phpmyadmin.net/home_page/docs.php
Most Linux based web hosting companies provide PhpMyAdmin as a standard feature with their packages. It is also available in a “Windows” IIS version. If your hosting provider does not already have this product installed they will often install it for you, or even allow you to install it yourself. Setup is quick and easy if you follow the step-by-step installation documentation.
Step One: Creating your new database
When you log in to your PhpMyAdmin welcome page, the first step is to enter a name for your new database in a text box provided. You can name your database anything that you wish, however if you are creating the database to use with a script or software package that you purchased somewhere, the script provider will often suggest a “preferred” database name. You should always create your database using the following format:
username_ databasename Example: myusername_mydatabase Your complete database name should always begin with your username followed by an underscore, then followed by the database name. This allows the server to know which user is in control of the new database, and it will also provide permission to access the database to only specific users. This also allows different users on the same server to use the same name for their own database, as you did, without interfering with your data - that is helpful if more than one user on your server bought similar software for their own site. They can then also use the software providers “preferred” database name.
Step Two: Creating a table for your new database
After you have created a database, the next step is to create a table, or even multiple tables, for you to store data. A table is the part of your new database that actually stores data.
You create a table by selecting the database that you created from the drop box list of databases. Once a database is selected a new form appears and asks for you to create a new table.
You must decide what you want to name your table and enter that name into the name box. Try to choose a name that reflects the type of data that will be stored in the table, such as orders, users, or inventory.
You then must decide how many “fields” or columns of data that you want to store for each record. If you need for the table to store five (5) different items, such as username, users email address, users telephone number, users account number, and the users age, than you would need five (5) fields. Simply enter the number 5 in the appropriate box. Once you hit create, the system will create a table and will add those fields into the table for you. Don’t worry about the number of fields you might need right now, as you can always add or delete fields later.
Step Three: Defining Fields
Once you have created your table you will be prompted to tell the database what features that you want each field to have. This looks complicated, but it’s not if you select your data type from the information below. You basically have to decide between three common data types and select the best choice for storing your data. If you make a mistake you can go back and edit the field.
If the field is to be used to store numbers, here are some choices:
TINYINT - A very small integer. The signed range is -128 to 127. SMALLINT - A small integer. The signed range is -32768 to 32767. MEDIUMINT - A medium-size integer. The signed range is -8388608 to 8388607. INT - A normal-size integer. The signed range is -2147483648 to 2147483647. BIGINT - A very large integer.
Some other less common number options include:
FLOAT- A floating-point number. DOUBLE - A double-precision floating-point number. DECIMAL - A packed exact fixed-point number.
If the field is to be used to store text or both text and numbers combined, here are some choices:
VARCHAR is for varying characters and can be up to 255 characters in length. TEXT is a column with a maximum length of 65,535 characters - easy to search. BLOB is a column with a maximum length of 65,535 characters - case- sensitive.
If the field is to be used to store dates, here are some choices:
DATE - A date. DATETIME - date and time combination. TIMESTAMP - useful for recording the date and time of an INSERT or UPDATE operation. TIME - A time.
Once you have selected the data type for your fileds you will need to let the system know how many characters that you will need to store in the field.
Example: if you are storing a username, you might want to select VARCHAR as your data type and allow up to 100 characters for that field. If you are creating a User Identification number you might want to select INT and allow up to six characters - that would allow you to have up to 999,999 users.
The last step to creating your data fields is to select any special attributes that you may find helpful. Some examples are:
Auto Increment : Auto-Increment fields are useful for assigning unique identification numbers for users, products, and customers, etc. By default, fields are incremented using number characters (like “1″, “2″).
Primary Key: The primary key is a data column that uniquely identifies a specific instance of that data. At least one of your fields must be a Primary Key. Username is an example of a good primary key. You do not want to have more than one individual having the same username.
Index Key: Allows you to speed up searches by designating a field as a preferred data source, especially when combining data from multiple tables.
Congratulations, once you have completed these steps you are ready to import data into your new database.
Here are step-by-step instructions to guide you through the process of changing web hosts for your web site. FYI, this is quite an easy affair so please leave all your fears behind.
Keep the username and password of your domain name account ready. These login details are different from the login information of your present web hosting company, unless you have purchased the domain name from the latter.
To repeat: You need the username and password of the account at the company from whom you bought the domain name.
Research and find a good and reliable web host. I am sure that the reason you want to change is because you are dissatisfied with the present company. We don’t want this to happen again… right? Hence, spend some time exploring the web and reading reviews. Maybe my list of recommended web hosting companies can help - take a look.
Once you have made your choice, purchase an appropriate web hosting package from them. Confirm the purchase and carefully read the emails that you receive from the company. As you can guess, the emails contain sensitive and important information. Taking a printout and keeping it in a safe place would be a smart thing to do.
Make sure you get the name server information of the new server. Your new web host should send you a primary and a secondary name server. It would typically be in the email you receive from the web host. If not (hmmm), check the support or FAQ pages on their web site. Still lost? Contact their technical staff immediately.
Now log in at your domain name account (refer point 1 above) and change the DNS information associated with your domain name to the new values. Generally, you will find a “Change Name Server” or equivalent link in your account. Make sure you enter both the primary and secondary name servers. For details, read how to change the name servers associated with my domain name.
When you modified the name servers, you would be told that the change will take 24 to 72 hours so you need to be patient. Nowadays, I have noticed that name server changes take place quite fast - 14-18 hours.
Why this lag time? The information on all domains is stored on certain computers scattered around the world. All of these machines need to be updated with the new information and that, I think you can understand, would take a bit of time.
Note: When you modify the DNS associated with your domain name you might (depends on your domain name registrar) receive an email from the company. This message would come on the email address used at the time of registering the domain name. The email would either inform you of the change or request a confirmation. Read it thoroughly and follow the instructions carefully.
Once your domain name has been associated with the new web host, you would be able to upload your web site on the server.
In the past few weeks, I’ve been appalled with the price that some churches and ministry organizations are paying for their web hosting. It’s not the church’s fault; many of them signed up with web hosting companies years ago, and are still paying the rates from years ago. Here are two examples of groups who I would say are simply being taken advantage of:
One church was paying $26.95/month for 100mb of storage space, 1 MySQL database and a limited number of email addresses and very poor customer service. In order to use another MySQL database, they would have to upgrade their account.
Another church group was paying $45/month for a “Premier” hosting package that included 100mb of storage space, 24-hr FTP access (I find that funny), up to 20 email accounts(!!!) and “no hidden charges or fees.” Absolutely ridiculous. The same web host charges the following for their “web design:” $425 for the Home page, and $225 for each additional page. Are you kidding me?
I feel like I should start a business that simply contacts every church that has a website and helps them to switch their sites to a new web host. I’d guess that over 90% of churches and small non-profits that have websites are paying 2, 3, 4-times more than they need to for their website/email packages. And it’s not their fault - years ago they just got into a web hosting contract with a company, and they’re not aware of the significant decrease in costs for these types of services now. And that’s how some churches are still paying someone $45/month for 100mb of space, 20 email accounts and 24-hr FTP access.
The other problem is that sometimes these web hosts are church members! It’s an issue of stewardship - and if someone in the church is making the church pay outrageous prices for something that can be as cheap as $5/month, that is just unacceptable. Granted, there may be some reasons why some churches stay with certain providers, but if you are on staff at a church that has a website, I’d encourage you to take a look and see what you’re paying for your web hosting and email services. My guess is that it is probably too much - and while it may take some phone calls and time figuring out how to switch to another host, it will save your church money in the long run.
Interested in starting a Wordpress blog? If you are currently running a Blogger blog, or just simply writing for other websites, it is probably about time you thought about running your own WordPress Blog. If you haven’t already, that’s probably because you feel a little overwhelmed about choosing web hosting and installing wordpress. Well, I’m going to make it easy for you!
You may not know, that some hosting companies offer an automatic install of Wordpress, and many other blog applications for that matter.Wordpress web hosting is actually very easy, and if you have your own hosting and domain, you website is considered much better for Google and other search engines.
To get started, you have to purchase a hosting account and domain. There are many hosting companies out there, but only some of them offer the easy of a simple, one click installation of Wordpress and you’re on your way! The best part about having your own Wordpress web hosting is that you own that web space, so, in business terms, you’ve accumulated an asset that God willing brings you to owning a valuable asset!
To get started, go to 3FN and get a small package, don’t forget to get a domain name also! They are a very reputable company, very popular company, I use them personally for almost all my websites and they also happen to have the cheapest prices! I personally like to just purchase the whole year, so that I don’t pay extra purchasing 6 months at a time.