Installing PHP on Windows for the first time

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Installing PHP on Windows for the first time

Post by Luke »

I am installing PHP5.2.0 on a machine running Windows XP Pro w/out IIS installed (yet). Would you guys recommend installing IIS or apache? I've never installed either of those servers or PHP on any machine ever, so I'm looking for the easiest route, and the only reason I'm installing it is to learn how, so what do you guys think I should do... IIS or apache? What's easier?
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Apache, it's quite simple to setup and it remains by far the most popular webserver on the net.

Apache has a Window's installer, and editing the httpd.conf file to enable PHP require only two additional lines. If you want a reference installation look up XAMPP to poke at with a stick to see how the configuration files ties together and can be setup.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I was leaning towards apache because I don't know where my windows installation CD is and the boss isn't here to find it...

Alright... another question...

I already have apache installed on this machine under wampserver. If I install apache again in a different directory, should I expect troubles?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

WOW

That was beyond easy. I've avoided installing PHP on my own for this long?? Man... installing PHP is a breeze. That took me the whole of maybe 30 minutes... and I was working while eating... that was EEEEEEAASY!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Installing Apache, MySQL and PHP on Windows is a breeze, with or without the "whole-package" installers. I'm often amazed how many people have a problem installing them.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I tried installing Apache 1.3x with PHP 5 a few years back when I first started learning PHP, and I ran into a few problems and gave up. Then I always saw all of the threads in this forum complaining about the difficulty of installation, so I've always put it off and installed w/wampserver. I'm amazed at the ease I just experienced. WOW.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

If you install apache (which you really, really should ;)), and if you plan on running a svn repository, don't install v2.2.x as the windows build of subversion was compiled against 2.0.x so accessing any repository via http(s):// won't be possible. (i was struggling with that problem for weeks/months before I found out why...)

You may also want to check out one of the many wamp-in-a-box bundles, such as xampp, I use it at work and it makes setting up your dev environment a 5 minute job (php/perl/apache/mysql/ftp and more in one go)...
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

but the point of this exercise was to learn how to install a server & php on a windows machine. Thanks though
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Windows installation is pretty simple - I think a lot of folk get caught up in the configuration, and often by following out of date tutorials.

Now all you need to do is set things up on Linux ;). Not quite so simple I'm afraid...
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Alright... I am trying to install mysql now. I uncommented "extension=php_mysql.dll" in the php.ini file, set the extension_dir directive to the correct path. I added the php directory to the path environment variable, and of course installed mysql. I also restarted apache. Anything I'm forgetting? I'm still getting this error:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 2
EDIT: Oh yea... it's apache 2.2 php 5.2 and mysql 5.0
Alright... can somebody set me straight here... this is how I understand it. the mysql extension will work with mysql 5.0, but to use all functionality of mysql 5.0 you have to install mysqli extension. Is this correct?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Run phpinfo().... you sure you editted the correct ini file? Copy the ini to C:\WINDOWS\php.ini

Also, double check the dll file is where you expect it to be. Did you install PHP from the zip bundle or the windows installer version? The zip file contains all the DLL files you need :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

phpinfo says nothing about mysql. I'm sure I edited the right file, and I know it's changes are taking effect, because I changed the error prefix to show errors in red, and it worked. The dll file is in the right directory and I installed from the zip bundle. I can't for the life of me figure out what is wrong... :?
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

I had the same problem... try putting the mysql dll files into the windows or the windows/system folder... worked for me!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

nope... that didn't work either. I installed mysql with no problems at work. None at all. I know that php.ini has the directory correct for the extensions, because i enabled gd and a few others and they worked. only mysql is having issues. Anything you guys can think of?

EDIT: nevermind... putting the libmysql.dll file in the WINDOWS directory worked. I wonder why it wouldn't work the other way... could it have to do with my other installation of php? I still have wampserver installed. Could that be it?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I don't run into that problem (of having to copy libmysql.dll) around since i add the %mysql%/bin directory to my patch...
The other essential thing to do is to add a PHP_RC (or whatever it's name is) to httpd.conf...
Post Reply