Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Installing Php, Apache And Mysql On Windows!, intermidiate knowledge of handling files
Rating 5 V
Lukey
post Oct 26 2005, 06:12 AM
Post #1


New Member
Group Icon
Group: *Premier*
Posts: 2
Joined: 26-October 05
Member No.: 7,788





WAMP: easier than you think
By Luke Labern


The PHP language, an apache server and a MySQL database are most welcome to any would-be programmer. And, if they cannot or do not wish to use a Linux environment, and want to use Windows, it is quite complicated to set up. At least, the majority of those who want to learn PHP have learnt HTML, maybe a bit of CSS (or may have been referred from PERL) and are new-ish.

The set-up, commonly known as “WAMP�; Windows: Apache: MySQL: PHP (sometimes PERL is the language instead of PHP but that is not important) go hand in hand. Although, Linux is probably a better OS for all of this, a lot of people do not want the hassle of setting it all up, even though it is relatively easy. Some people are just plain scared of shell code. Whatever.

Aside from Windows, the other three components are as free as oxygen: open source. I assume, from hereon, that you know what all three things you’re going to be installing actually are.

First of all, I will link you to the relevant places. With this article, instead of confusing you about where to save everything, I will give you the link to the correct webpage as we need it. First up: Apache.

NOTE: I will be writing this with these version used (the most current at the time of writing):
Apache 2.0.55
MySQL 4.1
PHP 5.0.5

When you follow this tutorial, I expect all installed files (as their default) to go to C:\program files, so make sure that they actually go to their default place (unless you use this more as a reference).

APACHE WEBSERVER

Download and install


http://httpd.apache.org/download.cgi

First of all, create a new folder on your desktop named “WAMP� where you can temporarily download all the installers to.

Go to the link above and download the Win32 Binary (MSI Installer).

When the download finishes run the installer and when prompted enter “localhost� as your server (minus the quotation marks) and your e-mail address, though it doesn’t really matter what e-mail address you put in.

Test the server

Open up a web browser (I suggest firefox, of course) and enter “localhost� or “http://localhost� into the address bar. When the page loads you should see a page congratulating you; you just correctly installed Apache!

Of course, you’ll probably just want to test it out some more, so providing you installed it to the default (which I told you to), find the folder: C:\Program Files\Apache Group\Apache 2\htdocs and insert an html document there.

If you want a new page to automatically load from ‘locahost’ instead of the default, add a new index.html file in ‘htdocs’ and choose “yes� when it asks you to replace the old one. For other files placed in htdocs, add a forward slash (/) and the file name with extention after ‘locahost’

E.g: for a file named “websitename.html� that is saved in ‘htdocs’, type: “http://localhost/websitename.html� into your address bar.

Next, it’s onto the databse, courtesy of MySQL.

MySQL DATABASE

Download and install


http://dev.mysql.com/downloads/mysql/4.1.html

The link above is the official place to download the packadge, but be warned: it’s pretty much intended at Linux users and you have to navigate your way down to the windows section (in Firefox, hold ctrl+f and type in “windows downloads� to get there faster) and download the Windows (x86). It’s bigger, but instead of the ‘essentials’ version there’s less chance of a file going missing.

Download to the temp folder on your desktop and run ‘setup.exe’. Follow the simple onscreen instructions and then, perhaps, it will have installed itself. What do I mean? Well, sometimes (depending on what you downloaded) there will be an additional set of windows to navigate through which will let you set a password and customise your database. You can skip this, but you will be faced with some conolse instructions if you do not want this graphical interface.

I suggest you use the new, easier options and of course to set a password, but if you’re more “hardcore� then by all means go ahead and do the following:

Click Star -> Run and type ‘cmd’ into the box and press ‘ok’. In the new console window type in (and hopefully receive) the following:

Enter: cd c:\mysql\bin
Enter: mysqld-max-nt --install
Response: Service successfully installed.
Enter: net start MySql
Console should say: The MySql service is starting.
Console should say: The MySql service was started successfully.

Well done; from either of the two different ways, you have installed MySQL!

But if you used the console window to set up the database you should still set a password by doing the following in a console window:

Enter: cd c:\mysql\bin
Enter: mysql -u root mysql
Response: Welcome to the MySQL monitor .....
Enter: UPDATE user SET Password=PASSWORD('new_password')
Enter: WHERE user='root';
Response: OK...
Enter: FLUSH PRIVILEGES;
Response: OK...
Enter: DELETE FROM user WHERE user='';
Response: OK...
Enter: DELETE FROM user WHERE Host='%';
Response: OK...
Enter: DELETE FROM user WHERE User='';
Response: OK...
Enter: DELETE FROM db WHERE Host='%';
Response: OK...
Enter: exit

And the console window will close.

Now it’s time for the PHP installation, which I think is the hardest by far. But I will make it as simple as possible.

PHP

Create a PHP folder


This step is very important; without this the PHP installation will not work. On your local disk directory “C:�, create the folder “PHP�. Download the zip package and extract the files into the C:\PHP folder.

Download and install

http://www.php.net/downloads.php

Under “Windows Binaries�, choose “PHP 5.0.5 zip package� (if that’s what you want, but I it is very important that, if you are following this tutorial you do) and download that to your temp directory.

When you unzip it, make sure it is unzipped to C:\PHP (see above).

Now, this is probably the most confusing part.

Select the following files (they may be named differently, but using your brain you should be able to workout which) and copy them into your C:\Program Files\Apache Group\Apache 2 folder.

C:\php\php5ts.dll
C:\php\sapi\php5apache2.dll
C:\php\php.ini-recommended

Rename ‘php.ini-reccomended’ (the one inside the Apache 2 folder) to ‘php.ini’ and open it in Notepad. Search for ‘doc_root’ until you find the line :

doc_root =

Change this line to:

doc_root = C:\Program Files\Apache Group\Apache 2\htdocs

Save and next navigate to C:\Program Files\Apache Group\Apache2\conf\ and find the file ‘httpd.conf’ and open it in Notepad.

Add the following lines to the bottom of the text:

LoadModule php5_module php5apache2.dll
AddType application/x-httpd-php .php
Save it.

Guess what? You just did it! PHP is installed. In fact, WAMP is installed!

Test PHP

To test that it actually has been correctly installed, click Start -> All Programs -> Apache -> Configuration -> Test configuration.

A console window should appear for a little less than a second then close itself. If this happens, everything is done! If not, take note of any errors displayed and refer to the instructions above.

For Apache to recognise PHP, Apache must be restarted. Click Start -> All Programs -> Apache -> Control -> Restart.

Now for the classic test of whether PHP and Apache are working together.

Create a new .txt document, preferably in Notepad.

Type in the following:

echo ‘If you can see the information below, PHP is correctly installed.’;
phpinfo();
?>

(note that anyone with a bit of php knowledge already will know that the semi-colon after the ‘phpinfo()’ line isn’t necessary, but just add it to be sure at this stage)

Save that as ‘phpinfo.php’ in the root doc folder, which is “C:\Program Files\Apache Group\Apache 2\htdocs�.

Open up a web browser and navigate to “http://localhost/phpinfo.php�.

If, when you reach the page, there is text saying “If you can see the information below, PHP is correctly installed.� And there is a long page of text in purple tables, then the text is right: we’re done!

Further reading

There are a lot of brilliant php tutorials and books around, but for a full-blown official documentation, visit php.net’s official master document!

http://www.php.net/manual/en/

Now, go learn PHP!

© Luke Labern Oct/05.
 
+Quote Post  Go to the top of the page
*D*
post Oct 26 2005, 10:12 AM
Post #2


Merry KissMoose
Group Icon
Group: Main Team
Posts: 15,988
Joined: 18-May 04
From: North Pole
Member No.: 2





hiya.gif Hi Luke and welcome, thanks for submitting this tutorial.
 
+Quote Post  Go to the top of the page
Lukey
post Oct 26 2005, 11:33 AM
Post #3


New Member
Group Icon
Group: *Premier*
Posts: 2
Joined: 26-October 05
Member No.: 7,788





Thanks. This tutorial wasn't even getting read in any other forums I posted it in so I went to a bigger stage.
 
+Quote Post  Go to the top of the page
*D*
post Oct 27 2005, 10:57 PM
Post #4


Merry KissMoose
Group Icon
Group: Main Team
Posts: 15,988
Joined: 18-May 04
From: North Pole
Member No.: 2





QUOTE(Lukey @ Oct 26 2005, 12:33 PM) *
Thanks. This tutorial wasn't even getting read in any other forums I posted it in so I went to a bigger stage.


Well it will be read here, they may not always reply though unless needing help.
 
+Quote Post  Go to the top of the page
FIY
post Oct 27 2005, 11:10 PM
Post #5


Getting Used To The Dots
Group Icon
Group: Member
Posts: 42
Joined: 9-October 05
Member No.: 7,441





They released MySQL 5.0.15 final on the 19th October.
What's new is here http://dev.mysql.com/doc/refman/5.0/en/news-5-0-15.html
 
+Quote Post  Go to the top of the page
Jethro
post Oct 28 2005, 06:47 PM
Post #6


Good Ol' Dot
Group Icon
Group: Honored
Posts: 226
Joined: 15-April 05
Member No.: 3,352





Also for anyone wanting to use Invision on a windows machine you may get this error on install.

QUOTE
Client does not support authentication protocol requested by server; consider upgrading MySQL client


From the MySQL console to resolve, it's a change in the password hash..

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';

mysql> FLUSH PRIVILEGES;


IPB
That movie guy!
 
+Quote Post  Go to the top of the page
the_iceman
post Oct 29 2005, 09:11 AM
Post #7


Good Ol' Dot
Group Icon
Group: *Premier*
Posts: 219
Joined: 27-October 05
From: Seattle, WA
Member No.: 7,814





Great information LUKEY! Thanks for providing this information to all of us dotters!


IPB
Jeff
 
+Quote Post  Go to the top of the page
Phyrriz
post Oct 29 2005, 10:15 AM
Post #8


Banned for Ripping
****
Group: Banned
Posts: 358
Joined: 8-October 05
From: Sundsvall
Member No.: 7,416





I was just about to post a php tutorial, also :}
 
+Quote Post  Go to the top of the page
zogo
post Jun 16 2007, 05:33 AM
Post #9


New Member
Group Icon
Group: Member
Posts: 1
Joined: 16-June 07
Member No.: 16,523





Looks like a great tutorial, I'm only having 1 problem (so far): After installing Apache 2.2, I went to http://localhost , but it prompted me for some sort of user/password (maybe .NET framework), even though nothing ever prompted me to set that login up. I'm using port 8080, as it could not install to port 80. Help?
EDIT: I installed it, but I installed the latest Apache version, and my phpinfo.php doesn't show up, and when I go to Start->All programs->Apache->Control I don't see a refresh blink.gif

This post has been edited by zogo: Jun 16 2007, 01:08 PM
 
+Quote Post  Go to the top of the page

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 21st August 2008 - 05:09 PM
Bad Credit Mortgages | Mortgage | Mobile Phone | Bad Credit Loans | Magazine Subscriptions