TUTORIAL: How to install PHP and MySQL on IIS

  • one2one
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 20 Nov 2007
  • Posts: 13
  • Loc: Lancaster, PA
  • Status: Offline

Post November 21st, 2007, 12:11 pm

phpmyadmin works great now.

awesome!

thanks alot for your help. I'll check out the rest of the forum and see whatelse is cooking around here :)
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 21st, 2007, 12:11 pm

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: 28 May 2003
  • Posts: 19509
  • Loc: Pittsburgh PA
  • Status: Offline

Post November 21st, 2007, 12:55 pm

Interesting solution. Where is your php.ini located? I just assumed it was in C:\Windows. Regardless Glad you got it.
  • one2one
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 20 Nov 2007
  • Posts: 13
  • Loc: Lancaster, PA
  • Status: Offline

Post November 21st, 2007, 1:19 pm

D:\PHP5

i added that to the system variables path in windows... i thought that would be enough.. aparently the reg key is needed in my case.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: 28 May 2003
  • Posts: 19509
  • Loc: Pittsburgh PA
  • Status: Offline

Post November 21st, 2007, 2:49 pm

good to know. I'm sure down the road someone else will be playing with the same thing and benefit from the solution. (probably me *lol). Thanks for letting us know how you did it. For the record for those reading in the future, if you use the Windows Installer, php.ini will be installed in C:\WINDOWS and the environment variable path set correctly for PHP. However a manual install won't do that, and you should copy php.ini and place it in the Windows directory.

Post December 24th, 2007, 8:51 am

Hey ATNO/TW, thanks for the superb tutorial on installed PHP and MySQL on Windows Server 2003 with IIS. I'm new here and truly new to IIS. My situation is, I have PHP installed, it is running, I have MySQL installed (MySQL Admin reports that is it also running. My issue, I am not having any success at getting the two scripts to talk to each other.

I am installing Joomla 1.0.13 (Stable) on that particular server and this is the confirmation screen data:

PHP version >= 4.1.0 Yes
- zlib compression support Available
- XML support Available
- MySQL support Unavailable
configuration.php Writeable
Session save path Unwriteable
Not set

MySQL Support - unavailable, why? What is going on? I've checked, double check and did everything form the php.ini file to dragging the libmysql.dll to the C:\Windows\system32 directory. PHP is running fine, MySQL is 'supposedly' running fine. Can someone please help me figure this problem out before I lose my insanity.

(*Note: Session save path is not important, Joomla does that on my working linux server sometimes and works properly.)

On the good note, everything works perfectly with usbwebserver from http://www.usbwebserver.com

Any help would be appreciated. Thanks in advance and Happy Holidays!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: 28 May 2003
  • Posts: 19509
  • Loc: Pittsburgh PA
  • Status: Offline

Post December 27th, 2007, 11:00 am

Thanks for the compliments on the tute. It's a little old and needs some updating. Hope to get to that soon.

Unfortunately, I've haven't installed Joomla on Windows yet, so not sure what kind of glitches might happen. I do have a friend that solely uses Joomla on IIS, though. If I catch him online I'll have him look at your post and see if he has any thoughts.

Might help to know which version of MySQL you installed.
  • x11
  • Born
  • Born
  • No Avatar
  • Joined: 09 Jan 2008
  • Posts: 3
  • Status: Offline

Post January 9th, 2008, 9:36 pm

Hi, I've been searching online for the last few hours trying to find the best (and most recently active) thread on the topic of Windows + PHP + MySql + phpMyAdmin installation. And, I'm pleased to report that this is by far the best resource that I could google.

I'm hoping that you can help me understand the problem that I'm currently experiencing with my installation.

I am using:
  1. MySql 5.1.22-rc-win32
  2. PHP 5.2.5-win32-installer
  3. phpMyAdmin 2.11.4-rc1-english
  4. Windows 2003 Server
  5. IIS 6.0


I've tested a phpinfo.php file containing
[php]<?php phpinfo() ?>[/php]
and a test.php containing
[php]<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'root', '<password redacted>')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('mysql') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM user';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);


if ( !is_dir( session_save_path() ) ) {
echo "'session.save_path' directory not set! Please set your session.save_path in your php.ini file.";
} else {
echo "'session.save_path' is set. ";
echo session_save_path();
}

?> [/php]

The results are a succesful phpinfo output containing the following (most likely relevant) entries:
Quote:
header (not titled)
Loaded Configuration File C:\PHP\php.ini

configuration
extension_dir C:\PHP\ext

mysql
Client API version 5.0.45

session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx

session.save_path C:\PHP\sessions


The output of the test.php looks like this (modified to remove password output)
Quote:
Connected successfully
localhost root *<password redacted> Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0
'session.save_path' is set. C:\PHP\sessions


Yet when I visit my myphpadmin page, I get

Quote:
phpMyAdmin - Error
Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.


I have reviewed the suggestions in this thread and granted both the IUSR_<machinename> and NETWORK_SERVICE users full control of the C:\PHP\sessions directory.


I would greatly appreciate your assistance. Please help me figure out what I'm doing wrong.

Thank you

Edit: Before you ask, I have tried to turn on log files and have been unsuccessful. I'm entirely willing to try to turn log files on but I will need instructions.
  • x11
  • Born
  • Born
  • No Avatar
  • Joined: 09 Jan 2008
  • Posts: 3
  • Status: Offline

Post January 9th, 2008, 9:45 pm

LOL :lol:

Well, I hate to remove my post as it might contain useful information for others who have similar problems... but after closing the web-browser and restarting it, I now get:

Quote:
Welcome to phpMyAdmin 2.11.4-rc1

Probably reason of this is that you did not create configuration file. You might want to use setup script to create one.

Error
MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)


phpMyAdmin was unable to read your configuration file!
This might happen if PHP finds a parse error in it or PHP cannot find the file.
Please call the configuration file directly using the link below and read the PHP error message(s) that you receive. In most cases a quote or a semicolon is missing somewhere.
If you receive a blank page, everything is fine.

./config.inc.php


I should be able to solve the remaining problems from here. I will report results briefly (I'm sure you'd like to know how it ends.)
  • x11
  • Born
  • Born
  • No Avatar
  • Joined: 09 Jan 2008
  • Posts: 3
  • Status: Offline

Post January 9th, 2008, 10:02 pm

Ok, ran the ./phpmyadmin/scripts/setup.php script and generated my config, then opened a new browser window (lesson learned) and voila... since I chose HTTP auth_type, I get prompted for a username & password using the Microsoft CHAP window.

Enter the appropriate username/pass and I have a working phpmyadmin installation.

Hopefully this information is helpful to someone, and thank you for putting together a well documented installation process, it was very helpful

Regards. 8)
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: 28 May 2003
  • Posts: 19509
  • Loc: Pittsburgh PA
  • Status: Offline

Post January 10th, 2008, 10:41 am

Thanks for updating. I just saw your PM. Sorry I couldn't get to it sooner. And thanks for the compliment on the tute.
  • rayeniguard
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 12 Jan 2008
  • Posts: 7
  • Status: Offline

Post January 12th, 2008, 8:25 am

Hello All:

Here's my scenario:

I have PHP, MYSQL running on Windows XP SP2, IIS V5.1.

Whenever I attempted to connect to mysql via php, I was getting a nasty fatal error referencing and undefined mysql_connect...

I managed to clear that up by creating an environmental variable PHPRC.

Now, whenever I test a connection to mysql, I get a blank browser page. Whenever, I attempt to insert data I get the HTML confirmation, but no entry has taken place.

I am at a lost. Has anyone experienced this before.

Thanks.
  • rayeniguard
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 12 Jan 2008
  • Posts: 7
  • Status: Offline

Post January 12th, 2008, 11:46 am

Update:

phpMyAdmin works fine. However, I cannot connect to mysql via php. I still get a blank page.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: 28 May 2003
  • Posts: 19509
  • Loc: Pittsburgh PA
  • Status: Offline

Post January 12th, 2008, 11:54 am

There is probably something wrong with your connection string then. phpMyAdmin works on php and uses MySQL so it sounds like you are set up fine.

What's your connection string you're trying to use?
  • rayeniguard
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 12 Jan 2008
  • Posts: 7
  • Status: Offline

Post January 12th, 2008, 12:56 pm

ATNO/TW wrote:
There is probably something wrong with your connection string then. phpMyAdmin works on php and uses MySQL so it sounds like you are set up fine.

What's your connection string you're trying to use?


I snagged this off the net:

<?
error_reporting(E_ALL);
$connection = mysql_connect("localhost:3306", "root") or die ("Cannot make the connection");
$db = mysql_select_db("word", $connection) or die ("Cannot make the connection");
$mynums = array(3,5,10,20);
if(in_array($_POST['select'],$mynums)) {
$sql = "SELECT * FROM Random ORDER BY RAND() LIMIT {$_POST['select']}";
}
$result=mysql_query($sql);
echo ($result);
?>
  • rayeniguard
  • Newbie
  • Newbie
  • No Avatar
  • Joined: 12 Jan 2008
  • Posts: 7
  • Status: Offline

Post January 12th, 2008, 10:03 pm

This test script actually worked:

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

So, it must be the connection string.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 12th, 2008, 10:03 pm

Post Information

  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2008. Driven by phpBB © 2001-2008 phpBB Group.

 
 
 
 

Need a pre-made web design for your website?

Check out our templates here: Ozzu Templates


400+ FREE Website Templates. Download Now!