By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,574 Members | 1,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,574 IT Pros & Developers. It's quick & easy.

Installing MySQL with Apache 2.2 and PHP 5.0

P: 3
This is a newbie, first-time post on this forum. I need help getting MySQL installed on my local server so that it will inter-operate with Apache 2.2. I am running WinXP Pro V2002 SP-2, Apache 2.2 and PHP 5.

The server seems to be running correctly because when I enter "http://localhost/filename.ext" in my browser's (IE, Fx, Op) address bar the named file displays as designed. Also, my text editor (HTML Pad 2006) previews my files, but of course I had to configure the editor to use the server and the browsers. My website, which consists of HTML, PHP, CSS, and graphics files - but NO MySQL - yet, displays on localhost just as it does on my hosted server.

I've downloaded and installed MySQL 5 - several times - but have been unable to make it run. Both Apache and PHP are installed in their own sub-dir within a higher level sub-dir. I placed MySQL in its own sub-dir at the same level with Apache and PHP.

Obviously, there are things I need to learn that are not yet part of my kit. I've tried googling and found may sites with good instructions but haven't found one that addresses my combination of Apache 2.2, PHP 5.0 and MySQL. I'm not certain, even, that I should be using MySQL 5.0.

I've reached the point with my site that I need database functionality. I have a name and address page of nearly 500 entries that I'm maintaining as 5 separate files, each with similar information (name, street address, city, state, ZIP code). I must maintain elements for each entry in the same relative position of each file to display it properly. This is an invitation to disaster. I do not use forms yet because I want to be able to store and display user responses without having to intervene manually.

You now know what I know (and can see that there is a great deal that I don't know). I would appreciate any help. Specifically, I'd like confirmation (or better information) that in choosing MySQL I'll be able to accomplish the objectives mentioned above AND that I have chosen the correct version of MySQL to work with my versions of Apache and PHP. I would be grateful for directions to tutorials that address MySQL installation and interoperability on my platform AND tutorials on learning to use MySQL - more specifically using it to back-end my website.

Thank you in advance.
Mar 14 '07 #1
Share this Question
Share on Google+
3 Replies


Atli
Expert 5K+
P: 5,058
Hi.

You were absolutely right in choosing MySQL to use with PHP and Apahce.
PHP has great support for MySQL.

Im pretty sure that your problem is not that MySQL is not working, I'm betting that you just need to add the MySQL module to you PHP installation.

This is not very difficult to do. I'll attempt a simple exlanation.

First, you would have to find the php.ini file. The best way in my experience is to create a .php file with this command:
[php]<?php echo phpinfo(); ?>[/PHP]

When you run that file, you fill find a line, close to the top of the file that reads: "Configuration File (php.ini) Path".
Open that file.

In there you must find two lines and change them:
Expand|Select|Wrap|Line Numbers
  1. // Change
  2. ;extension=php_mysql.dll
  3. ;extension=php_mysqli.dll
  4.  
  5. // So they look like this
  6. extension=php_mysql.dll
  7. extension=php_mysqli.dll
  8.  
Now go back to the phpinfo file you created earlier and find another line,
extension_dir

This line must point to the 'ext' folder inside your php installation directory.
If it does not find the extension_dir in the php.ini file and change it so it points there.

You might also want to check inside the folder your extension_dir points to and make sure the files php_mysql.dll and php_mysqli.dll exist.
If they dont you can find them in the ext folder in the zipped version of php you download at php.net and copy them to you php install dir.

Now, once all that is done you will have to restart apache. Now you should be able to use MySQL.
Mar 15 '07 #2

P: 3
Thank you, Atli!

Here is what I have in php.ini:
Expand|Select|Wrap|Line Numbers
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                                      uncommented php_mysql.dll 20 Jan 
  3.  
  4. 2007 - rhh
  5. extension=php_mysql.dll
  6. extension=php_mysqli.dll
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
and
Expand|Select|Wrap|Line Numbers
  1. ; Directory in which the loadable extensions (modules) reside.
  2. extension_dir =C:\Program Files\PHP\ext
Should I have a sub-dir "C:\Program Files\PHP\ext\"? I have the "C:\Program Files\PHP" sub-dir but not the final one '\ext'? If I should have this sub-dir, what should be in it? Everything for PHP is installed in the "C:\Program Files\PHP\" sub-dir and there are only two sub-dir's contained in it: 'dev' and 'PEAR'. Each of those contains a single file. Is there a part of PHP that I did not install? Should the file "php.ini" have only this part of the 'extension_dir' statement: extension_dir =C:\Program Files\PHP", without the final '\ext'?

Thank you, again, for the response.
Mar 15 '07 #3

Atli
Expert 5K+
P: 5,058
If you installed PHP using the installer, it may not have installed or even copied the .dll files required for the MySQL modules.

There should be a /ext/ sub-dir in your PHP installation directory.
(C:/Program Files/PHP/ext/ in your case I belive).
Inside that file should be a bunch of .dll files that are required by various modules. Two of them should be 'php_mysql.dll' and 'php_mysqli.dll'.
The first one provides support for the mysql functions.
The socond one provides support for the improved version of them, mysqli.

If you do not have these files, you can download the zip version of the installer from www.php.net, unzip it and copy the ext folder into your PHP installation directory.
Mar 16 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.