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

My PHP file is unable to connect MYSQL

Rahulnewdelhi
P: 7
hello all

Hello all

I installed php, mysql and IIS in xp. Problem is this while i run following file

PHP Code:
----------------

<?php
phpinfo();
?>

it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

please help me

regards
May 4 '07 #1
Share this Question
Share on Google+
12 Replies


P: 1
i will want you to send me your mail adress anmd i will send ou the mailer on
here is my mail adress(jamescott_2@hotmail.com)...



Hello all

I installed php, mysql and IIS in xp. Problem is this while i run following file

PHP Code:
----------------

<?php
phpinfo();
?>

it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

please help me

regards[/quote]
May 4 '07 #2

P: 4
i think you need to verify dynamic extensions in "php.ini " (your configuration file)
extension=php_mysql.dll
extension=php_mysqli.dll
don't forget to restart your server
May 4 '07 #3

pbmods
Expert 5K+
P: 5,821
Did you install PHP after you installed MySQL? DId you install PHP with MySQL support? It's been awhile since I've worked on a PC, but when you're using the PHP installer, it should give you the option to install optional components. Verify that MySQL is selected in that list.
May 5 '07 #4

Rahulnewdelhi
P: 7
Hello all

I installed php, mysql and IIS in xp. Problem is this while i run following file

PHP Code:
----------------

<?php
phpinfo();
?>

it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

please help me
May 8 '07 #5

ak1dnar
Expert 100+
P: 1,584
[PHP]<?php
if (function_exists('mysql_connect')) {
echo "function available.<br />\n";
} else {
echo "function not available.<br />\n";
}
?> [/PHP]

what is the output that you can get in your end for this script.
May 8 '07 #6

Motoma
Expert 2.5K+
P: 3,235
You may still need to configure PHP to work with MySQL. PHP.net is a great resource for such information.
May 9 '07 #7

Rahulnewdelhi
P: 7
This function is not working and showing result "function not available".



[PHP]<?php
if (function_exists('mysql_connect')) {
echo "function available.<br />\n";
} else {
echo "function not available.<br />\n";
}
?> [/PHP]

what is the output that you can get in your end for this script.
May 10 '07 #8

ak1dnar
Expert 100+
P: 1,584
This probably the configuration on your PHP.ini read this article.
Installation on Windows Systems
May 10 '07 #9

P: 3
This post may have something to do with your problem.
http://www.thescripts.com/forum/thread429124.html

I'm currently in the same boat as you, both PHP and MYSQL are running, but PHP doesn't seem to be finding the php.ini file, which in turn results in the /ext/ directory (where the php_mysql.dll is located) not being read correctly.

If you run the phpinfo() function, you will see a summary of all php environment.
My guess is you will find the values you've entered in your php.ini file are NOT the ones being used. The post above seems to indicate a solution, however he was not very specific in the steps taken to resolve this issue. I would like to contact him to determine those steps, but he posted as a guest user. Hopefully someone else has info on the permissions solution he described.Good luck, I will post back here once I've figured this out.
bh
May 25 '07 #10

Rahulnewdelhi
P: 7
hey friend finally i found the solution of this problem. i tell you

after installation of php and mysql check both r working or not.

1. open you php.ini file and find extension=mbstring.dll and remove semicolon ";" before this dll.

2. Find extension=php_mysql.dll and again remove semicolon ";" before this dll

3. Find extension_dir="./" and replace it with extension_dir=c:\php\ext

then save and exit from your php.ini file

4. right click on your mycomputer icon and click properties

(o) Select advance tab

(o) Click on environment variable

(o) Click on new button from system variable area

(o) put PHPRC as variable name and C:\php as variable value and then click several ok

(o) Restart you web server and run php file contained phpinfo(); function and you will see mysql configration table











This post may have something to do with your problem.
http://www.thescripts.com/forum/thread429124.html

I'm currently in the same boat as you, both PHP and MYSQL are running, but PHP doesn't seem to be finding the php.ini file, which in turn results in the /ext/ directory (where the php_mysql.dll is located) not being read correctly.

If you run the phpinfo() function, you will see a summary of all php environment.
My guess is you will find the values you've entered in your php.ini file are NOT the ones being used. The post above seems to indicate a solution, however he was not very specific in the steps taken to resolve this issue. I would like to contact him to determine those steps, but he posted as a guest user. Hopefully someone else has info on the permissions solution he described.Good luck, I will post back here once I've figured this out.
bh
Jun 1 '07 #11

Rahulnewdelhi
P: 7
hey friend finally i found the solution of this problem. i tell you

after installation of php and mysql check both r working or not.

1. open you php.ini file and find extension=mbstring.dll and remove semicolon ";" before this dll.

2. Find extension=php_mysql.dll and again remove semicolon ";" before this dll

3. Find extension_dir="./" and replace it with extension_dir=c:\php\ext

then save and exit from your php.ini file

4. right click on your mycomputer icon and click properties

(o) Select advance tab

(o) Click on environment variable

(o) Click on new button from system variable area

(o) put PHPRC as variable name and C:\php as variable value and then click several ok

(o) Restart you web server and run php file contained phpinfo(); function and you will see mysql configration table





hello all

Hello all

I installed php, mysql and IIS in xp. Problem is this while i run following file

PHP Code:
----------------

<?php
phpinfo();
?>

it doesnt show mysql info table in result. I seen mysql server it is running well. While i am trying to connect

my php file to mysql database then it doesnt connect. why it is happening? how to short out this problem,

please help me

regards
Jun 1 '07 #12

pbmods
Expert 5K+
P: 5,821
Merged duplicate threads.

Changed thread title to remove annoying 'help me'.
Jun 3 '07 #13

Post your reply

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