Results 1 to 10 of 10

Thread: [RESOLVED] PHP and MySQL are being anti-social.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Resolved [RESOLVED] PHP and MySQL are being anti-social.

    Quote Originally Posted by Slyke View Post
    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:
    PHP Code:
    extension_dir "B:/WAMP/apps/php/php_5.2.9-2/ext/" 
    PHP Code:
    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:
    PHP Code:
    Directive    Local Value    Master Value
    extension_dir    C
    :/php5    C:/php5 
    That directory doesn't exist, never has . 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 ?
    Last edited by Slyke; Oct 31st, 2009 at 10:42 AM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: PHP and MySQL are being anti-social.

    Double post some how happened when I edited my original post...
    Last edited by Slyke; Oct 31st, 2009 at 05:15 AM.

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP and MySQL are being anti-social.

    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:

    Code:
    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.
    Last edited by kows; Oct 31st, 2009 at 11:28 AM.

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: PHP and MySQL are being anti-social.

    @ 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.
    Last edited by Nightwalker83; Oct 31st, 2009 at 08:21 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP and MySQL are being anti-social.

    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.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: PHP and MySQL are being anti-social.

    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.

  7. #7
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: PHP and MySQL are being anti-social.

    Quote Originally Posted by kows View Post
    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.

    Quote Originally Posted by Slyke View Post
    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.
    Last edited by Nightwalker83; Oct 31st, 2009 at 08:39 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  8. #8
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP and MySQL are being anti-social.

    make sure you read this incredibly important part of my post:
    Quote Originally Posted by kows View 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.
    Quote Originally Posted by Nightwalker83 View Post
    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. :/

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: PHP and MySQL are being anti-social.

    Quote Originally Posted by kows View Post
    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.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: PHP and MySQL are being anti-social.

    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 .

    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 .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width