PDA

Click to See Complete Forum and Search --> : [RESOLVED] PHP and MySQL are being anti-social.


Slyke
Oct 31st, 2009, 05:06 AM
I have installed Apache, MySQL services on a windows box I have at home, and configured Apache and PHP to talk to each other.

Basically I can run PHP scripts, and I can also enter commands into the SQL console.

The part I'm having problems with is getting PHP to talk to the MySQL server.

I've edited the php.ini file to:
extension_dir = "B:/WAMP/apps/php/php_5.2.9-2/ext/"
extension=php_mysql.dll
extension=php_mysqli.dll

When I run phpinfo() it doesn't look like MySQL is being loaded. PHPMyAdmin also errors when I try to run it:


Documntation says:


I'm not sure what else I can do to get it working. Any suggestions?

Edit:
For some reason the phpinfo() is saying:
Directive Local Value Master Value
extension_dir C:/php5 C:/php5
That directory doesn't exist, never has :confused:. Why it's not going to the one I set it to I have no idea.

Edit2:
Upon further investigation, I've found that PHP is erroring:
[01-Nov-2009 01:34:07] PHP Warning: PHP Startup: Unable to load dynamic library 'B:/WAMP/apps/php/php_5.2.9-2/ext/php_pdo_mysql.dll' - The specified module could not be found.

in Unknown on line 0

[01-Nov-2009 01:34:07] PHP Warning: PHP Startup: Unable to load dynamic library 'B:/WAMP/apps/php/php_5.2.9-2/ext/php_pdo_mysql.dll' - The specified module could not be found.

in Unknown on line 0




I can confirm that this file does exist in this place. Some other modules are loading, but others are coming up with the same error. For example, the curl extension works fine.

Edit3:
I can rename 'php_curl.dll' to say 'bob.dll' and PHP will load it correctly. If I rename the 'php_pdo_mysql.dll' file to 'bob.dll', it says it can't find the file.

I'm really confused as to what's happening here. I know the DLLs are fine as I've tried them in another WAMP server... I'm thinking there's some config I haven't set yet... any help :D?

Slyke
Oct 31st, 2009, 05:10 AM
Double post some how happened when I edited my original post...

kows
Oct 31st, 2009, 11:22 AM
well, this looks like just another reason not to use something like this!

anyway, check to make sure your httpd.conf (Apache configuration file) is pointing to the "correct" PHP ini file. otherwise, it could be looking for it in some other location and assigning a default value to extension_dir. you should be able to search for "PHPIniDir" to find it. if it doesn't exist, you can set it. like so:

PHPIniDir "C:/whatever/your/php.ini/directory/is"

other than that, I'm not sure right now. I've never used "WAMP" and I would always suggest you learn how to install Apache, MySQL and PHP separately yourself rather than letting something else do it. it will ensure things like this don't happen.

oh yeah, and make sure you add your PHP install directory to the Windows "PATH" environment variable, or at least copy libmcrypt.dll, libmhash.dll, and libmysql.dll into the windows/system32/ directory. I don't know if this "WAMP" thing does any of that for you.

Nightwalker83
Oct 31st, 2009, 07:08 PM
@ Slyke,

You say you edited the php.ini to that location! What was the initial install location you chose when you run Wamp setup? The directory you entered into the setup program.

Edit:

You can only install WAMPServer to the initial setup install location! I just tried it by choosing the default install location "c:/wamp" then once it was installed copying the files to my "d:\" drive. I then changed the php.ini line as above to the location on my "d:\". I then thought since I have two copies of WAMP on my computer I could uninstall the one on my "c:\" because I changed the location, etc from "c:/" to "d:/". However, after that I attempted to run Wamp from its new location and received the message "Aestan Tray has stopped working".

Edit II:

You need to change locations in wampmanager.ini as well in order to Aestan Tray to work. You are going to have to check all the configuration files, etc to make sure they all refer to the new wamp location.

kows
Oct 31st, 2009, 08:13 PM
that's probably because you literally copied the install directory from one drive to another. apache and mysql are both installed as services, so this would mess both of them up. like I said before, I've absolutely no experience with "WAMP," but I'm not surprised in the least that what you did made it not work. a general rule of thumb is that if you install a program, you probably can't just take its directory and copy it where ever you'd like and expect it to run correctly from there. registry entries are made that hold reference to where these applications were installed as well, and this may or may not stop the application from running correctly.

if you just installed it on the other drive, I'm sure it would run just fine.

Slyke
Oct 31st, 2009, 08:22 PM
I downloaded Apache, PHP and MySQL all separately and have written a program to update the config files when it starts. PHP and Apache are working together. I can enter commands into the MySQL console. Just PHP won't detect the MySQL functions (and hence can't talk to the MySQL server). I wanted to get familiar with how these 3 services work. I've learnt a lot (Like MySQL can't read UTF-8 config files). But this has me confused.

PHPIniDir is pointing to the correct PHP directory inside my WAMP server (configured in the httpd.conf).

They are all working - just for some reason, MySQL and PHP won't talk.

I'm going through all the config files to see if I have somewhere else to tell PHP about MySQL.

The odd thing is that some of the extensions load, while others do not, which leads me to think that there's another config on locations.

phpinfo() is now saying it's loading up the correct config file, and I can disable or enable extensions, they show up on the phpinfo() page. Just not the MySQL ones.

My goal is to make a portable WAMP server, and I'm very close. This is the last thing that's not working.

Nightwalker83
Oct 31st, 2009, 08:32 PM
that's probably because you literally copied the install directory from one drive to another. apache and mysql are both installed as services, so this would mess both of them up. like I said before, I've absolutely no experience with "WAMP," but I'm not surprised in the least that what you did made it not work. a general rule of thumb is that if you install a program, you probably can't just take its directory and copy it where ever you'd like and expect it to run correctly from there. registry entries are made that hold reference to where these applications were installed as well, and this may or may not stop the application from running correctly.

if you just installed it on the other drive, I'm sure it would run just fine.

As I said in my above post it is possible! However, there is a lot of editing of files involve.

I downloaded Apache, PHP and MySQL all separately and have written a program to update the config files when it starts. PHP and Apache are working together. I can enter commands into the MySQL console. Just PHP won't detect the MySQL functions (and hence can't talk to the MySQL server).


See my post above.

Edit:


My goal is to make a portable WAMP server, and I'm very close. This is the last thing that's not working.

There is a portable Wamp server already Uniform Server (http://www.google.com.au/#hl=en&source=hp&q=portable+wamp+server&meta=&aq=0&oq=Portable+wamp&fp=2fc8558267712604).

kows
Oct 31st, 2009, 09:13 PM
make sure you read this incredibly important part of my post: oh yeah, and make sure you add your PHP install directory to the Windows "PATH" environment variable, or at least copy libmcrypt.dll, libmhash.dll, and libmysql.dll into the windows/system32/ directory. I don't know if this "WAMP" thing does any of that for you.

As I said in my above post it is possible! However, there is a lot of editing of files involve.yeah, except I replied to you before you edited your post. :/

Nightwalker83
Oct 31st, 2009, 09:18 PM
make sure you read this incredibly important part of my post:

yeah, except I replied to you before you edited your post. :/

Yeah, for some reason your post didn't show for me after I had originally edited my post.

Slyke
Oct 31st, 2009, 10:54 PM
I don't know what I did. I just got back from lunch with a friend and booted up my computer. It's working now.

Haven't changed any config files or anything since I last checked it. It's really strange, but oh well it's working now :D.

I think MySQL was having problems and that's why PHP wouldn't work with it. Just wanted a nice cold boot.

Thanks for your help though guys :D.