Jump to content

Connecting to MySQL


Recommended Posts

Hey All. Semi Newb Here. I have installed, configured and had PHP running on a Mac OS X Server (Which is still running fine!), but I am having some issues with a Windows Server at my new job. I am not a programmer, but I have managed to run my own webserver fairly well in the past (Again, on OS X).

 

They have PHP 5 installed on a Windows Server 2003 for small Business, and they have MySQL running on another IP address on the same machine. How do I tell PHP where the MySQL is?

 

When I check the phpinfo.php file, it does not have any MySQL information like it does on one of my hosting accounts. The MySQL is installed (Again, on another IP), and the two .dll files are uncommented in the php.ini file, and the PATH is set correctly. We want to install WordPress for a project we are working on, and we keep getting: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

 

So, my thinking is that the PHP just doesn't know where to find MySQL since it's running on a different IP, I just don't know how to tell it where it is. The PC tech thinks it may be a permissions issue, but I am have no idea about Permissions on Windows. We know the MySQL is running and functioning, as there are 7 other sites with Databases in them and they are working fine. Nobody here really knows PHP (Though they are learning), we do mainly ASP.

 

If you need anymore information, let me know and please be specific, as I mentioned, I am still fairly new to this and I am not a programmer! Thanks a ton!

Link to comment
Share on other sites

They have PHP 5 installed on a Windows Server 2003 for small Business, and they have MySQL running on another IP address on the same machine. How do I tell PHP where the MySQL is?

 

When I check the phpinfo.php file, it does not have any MySQL information like it does on one of my hosting accounts. The MySQL is installed (Again, on another IP), and the two .dll files are uncommeted in the php.ini file, and the PATH is set correctly.

 

Before enabling any extensions within the php.ini make sure you done the following first

 

1. Open your php.ini and set up the extension_dir directive to point to PHP's extension folder (eg extension_dir = "C:/php/ext")

 

2. You're restarting your server (by this I mean software, not hardware eg IIS, Apache etc) when ever you change the php.ini.

 

3. Run phpinfo and make sure PHP is reading the php.ini you're modifying. To check this look for the Loaded Configuration File line. This should be set to the full path to the php.ini PHP is reading. As you have added PHP to the PATH, your php.ini should be in the root of your PHP installation folder.

 

NOTE: Ignore the Configuration File (php.ini) Path line above if its set to C:\WINDOWS (this is not where your php.ini needs to be).

 

Step three is the most important, if step three fails then you wont be able to configure PHP.

 

If PHP is reading your php.ini try uncommenting the mysql extension line ;extension=php_mysql.dll (remove the ; at the start of the line). Then repeat step 2 above. Confirm the extension is loaded by running phpinfo and looking for a MySQL subheading.

 

Also note that the mysql extension does not reply upon a local install of MySQL. However it does reply on the mysql client though, this comes with PHP in the form of libmysql.dll

 

 

Link to comment
Share on other sites

wildteen88

 

The path was set correctly, I restarted web services after every change and save, all MySQL extension lines are uncommented in the php.ini file and the 'loaded configuration file' is showing the proper path as well. Though when you check the phpinfo, it does not mention MySQL at all, I compared to the phpinfo file on my hosting, which shows lots for MySQL.

 

The only mention of anything SQL is this under the PATH variable: C:\Program Files\Microsoft SQL Server\80\Tools\Binn\

 

 

Corbin

 

When I run the command you gave me, I get this error:

Fatal error: Call to undefined function mysql_connect() in C:\Customers\phptest.php on line 4

 

I am taking this as a good thing, as I am hoping it will reveal a bit more on the issue itself(?).

Thanks for the help thusfar!

Link to comment
Share on other sites

The other tech I am working with is wondering if it could be a permissions issue?

We installed the PHP via the installer package from the php.net site. The actual hardware has not been restarted, but the web services have been restarted after every php.ini change (As mentioned previously)

Link to comment
Share on other sites

What web server? Exactly where/how are you restarting the web services?

 

Windows Server 2003 for small Business

 

Start -> All Programs -> Administrative Tools -> Services -> World Wide Web Publishing Services

(As directed by the SysAdmin).

 

Let me say, I would really like my OS X servers back.

 

Link to comment
Share on other sites

Have you checked the web server error log file (on IIS I believe this is the Windows event log)?

 

Is the php_mysql.dll in the ext folder and the libmysql.dll in the php folder?

 

About the only thing else that comes to mind is a folder/file permission problem (the IUSR_xxxxx account does not have permissions set for the php or ext folder.)

Link to comment
Share on other sites

Have you checked the web server error log file (on IIS I believe this is the Windows event log)?

 

Is the php_mysql.dll in the ext folder and the libmysql.dll in the php folder?

 

About the only thing else that comes to mind is a folder/file permission problem (the IUSR_xxxxx account does not have permissions set for the php or ext folder.)

 

I just got the locations for the log files. Not quite sure what I am looking for, but I know how to troubleshoot and get it to generate things as I go.

 

I have the php_mysql.dll file, but noe the libmysql.dll file. This should go in the main php folder? Is there anything I need to turn on for this file? Other than what I have already uncommented in the php.ini file?

Link to comment
Share on other sites

I just got the locations for the log files. Not quite sure what I am looking for, but I know how to troubleshoot and get it to generate things as I go.

 

I have the php_mysql.dll file, but noe the libmysql.dll file. This should go in the main php folder? Is there anything I need to turn on for this file? Other than what I have already uncommented in the php.ini file?

You saying libmysql.dll is not found within your PHP Installation folder? If that is case the mysql extension will not function without it. I recommend you to download the zipped binaries package. Once the zip has downloaded extract the contents of the zip to where you have PHP installed. Making sure you overwrite existing files/folders.

 

libmysql.dll should now be available, restart IIS. Check whether mysql is available by phpinfo. I do not recommend the PHP installer, It is best to do all configuration by hand.

Link to comment
Share on other sites

Whoever installed the PHP previously used the Installer. I am reinstalling from the binary package.

I removed the PHP folder (Well, renamed to PHP_bk to keep it from reading) as well as removing the PHP info from PATH in the Environment Variables.

 

Do I need to restart IIS? Or do I just need to restart Web Services?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.