Jump to content

php does not work with mysql


paul_

Recommended Posts

hi all

I have just install apache 2.2.4 , PHP 5 and Mysql 5.0.27 on winxp home. Heres the problem when i run a connection script to connect to the mysql db and select a db, all thats coming up is a blank page. When i put the script on my host server it say "cant connect to db " etc etc which running on my own pc is not doing.

Any idea why its not putting text up letting me know if anthing is wrong.


Thanks inadvance

Paul
Link to comment
https://forums.phpfreaks.com/topic/36237-php-does-not-work-with-mysql/
Share on other sites

try connecting using commandline

start->run->type cmd 

A command prompt opens.

cd "c:\...... your path to mysql/bin here."

then run mysql -u USERNAME -p [enter]

it should prompt you for a password..

If that works then you have installed and configured it correctly
Make a php file and put the code

[code]
<?php
phpinfo();
?>
[/code]

name it whatever you want, put it in your root folder and browse to the page, and look for the section labeled mysql, if it is there than it is simply a problem with the information you provided for the database connect
[quote author=thorpe link=topic=124600.msg516502#msg516502 date=1170110493]
[quote]Any idea why its not putting text up letting me know if anthing is wrong.[/quote]

You need to enable [i]display errors[/i] in your php.ini.
[/quote]

Done that still dont work, still show a blank page even though the connection detail are worng so it show , access deined etc
[quote author=Fearsoldier link=topic=124600.msg516507#msg516507 date=1170110737]
Make a php file and put the code

[code]
<?php
phpinfo();
?>
[/code]

name it whatever you want, put it in your root folder and browse to the page, and look for the section labeled mysql, if it is there than it is simply a problem with the information you provided for the database connect
[/quote]

NO Mysql sections listed
there's probably a few issues. check to see if you have a php_mysql.dll file anywhere. if so, tell us where. also look in your php.ini file and uncomment the line that says [code]extension=php_mysql.dll[/code]

if it has a semicolon in front of it, delete the semicolon, save it. restart apache.
[quote author=boo_lolly link=topic=124600.msg516522#msg516522 date=1170111382]
there's probably a few issues. check to see if you have a php_mysql.dll file anywhere. if so, tell us where. also look in your php.ini file and uncomment the line that says [code]extension=php_mysql.dll[/code]

if it has a semicolon in front of it, delete the semicolon, save it. restart apache.
[/quote]

php_mysql.dll cant be found i did a search for it!
your PHP should probably be in C:\ not in Program Files.  it really doesn't matter much, but it's much easier to keep track of. try this...
create a test script... call it test.php
[code]
<?php
        //test.php

        echo "Hello, World!\n";
?>
[/code]
and place that file in C:\Program Files\PHP\
then...

[code]
run: cmd

C:> cd C:\Program Files\PHP
C:\Program Files\PHP> php.exe test.php
[/code]
if it prints 'Hello, World!' to the command prompt, then you've done something right =) !


[quote]I believe php also requires libmysql.dll[/quote] you are correct.
[quote author=paul_ link=topic=124600.msg516610#msg516610 date=1170114680]
[quote author=fert link=topic=124600.msg516583#msg516583 date=1170113718]
I believe php also requires libmysql.dll
[/quote]

Its working now but libmysql.dll was not required.

Thanks for everyones answers they were great :D
[/quote]
PHP most probably found another one somewhere else then. Most probably the libmysql.dll in the MySQL bin directory.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.