PHP + MySQL => Can't create TCP/IP socket (10106)

Hello!

I’m trying to connect to a MySQL database from my PHP code, but I keep getting the following error message: Can't create TCP/IP socket (10106)

This is my code:

<?
$connection = mysql_connect("127.0.0.1", "root") or die ("Unable to connect!");

mysql_close($connection);
?>

And this is the complet error message:

Warning: mysql_connect() [function.mysql-connect]: Can't create TCP/IP socket (10106) in D:\xxxx\index.php on line 18
Unable to connect!

This is the MySQL part of my php.ini

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =3306
mysql.default_socket = mysql
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = -1
mysql.trace_mode = Off

I’m running Windows 2000 Server, Orion 1.5.2 as web/application server, MySQL 3.23.55-nt and PHP 4.3.1 (installed from the windows installer file)

I have no problem connecting to the database from JSP on the same server.

I have read a few messages from others having problems like this, but I have not found any solution.

Hope someone can help me!

Best regards

Anders
alfabetmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carchitectCommented:
$connection = mysql_connect("127.0.0.1", "root") or die ("Unable to connect!");

incomplete

$connection = mysql_connect("127.0.0.1", "root","root") or die ("Unable to connect!");
0
alfabetmanAuthor Commented:
That did not change anything.

I have also tried with a odbc connection now. I have tested the connection from another application (on the same computer) and it works fine! But when I try it from PHP I get the same error message as with the mysql_connect.

Here is the code

<?
$connection = mysql_connect("localhost", "root", "root");
?>
     
<?
$connection = odbc_connect("windelhed", "", "");
?>

And here are the error messages.

Warning: mysql_connect() [function.mysql-connect]: Can't create TCP/IP socket (10106) in D:\orion\web-applications\...\index.php on line 16

Warning: SQL error: [MySQL][ODBC 3.51 Driver]Can't create TCP/IP socket (10106), SQL state S1000 in SQLConnect in D:\orion\web-applications\...\index.php on line 21
0
carchitectCommented:
sorry wrong folder for files
put your files in wwwroot folder ...
c:\inetpub\wwwroot\orion\web-applications\..\index.php

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

alfabetmanAuthor Commented:
That did not change anything.

I have also tried with a odbc connection now. I have tested the connection from another application (on the same computer) and it works fine! But when I try it from PHP I get the same error message as with the mysql_connect.

Here is the code

<?
$connection = mysql_connect("localhost", "root", "root");
?>
     
<?
$connection = odbc_connect("windelhed", "", "");
?>

And here are the error messages.

Warning: mysql_connect() [function.mysql-connect]: Can't create TCP/IP socket (10106) in D:\orion\web-applications\...\index.php on line 16

Warning: SQL error: [MySQL][ODBC 3.51 Driver]Can't create TCP/IP socket (10106), SQL state S1000 in SQLConnect in D:\orion\web-applications\...\index.php on line 21
0
alfabetmanAuthor Commented:
I can not put the files in the that folder, because I’m not using IIS. I’m using orion 1.5.2

Do you think it is a path problem?

If I create a php page without a database connection it works fine!
0
Richard QuadlingSenior Software DeveloperCommented:
Can you run <?php phpinfo(); ?> and see what mysql/odbc support is provided by PHP.

Richard.
0
psadacCommented:
Are you sure of your mysql password ?
Generally mysql has a blank default root password (this should be changed immediately), so the connection instruction  would be :

$connection = mysql_connect("localhost", "root", "");

have you already created a dsn with the mysql odbc driver ? have you tested the connection ?
0
splishsplashCommented:
..and odd problem. I guess I'm not adding too much to this conversation by tell you all it isn't an MySQL authentication issue.

A simular report (OrionServer 1.3.8 / NT4 / PHP) of this problem is reported in the PHP bug database:
http://bugs.php.net/bug.php?id=7951&edit=1

..yet it is unclear if the problem was confirmed to be fixed in the PHP v4.1.0RC3.

hmm...try posting it to the php-dev mailing list and let them know you are having the same problem.
0
alfabetmanAuthor Commented:
Thank you all for trying to help me!

I finally gave up and installed an Apache server instead of Orion. It works fine now... (with the same code)

Anders
0
Richard QuadlingSenior Software DeveloperCommented:
Ho hum!
0
snoyes_jwCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation in the Cleanup topic area:

PAQ/Refund Points

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

snoyes_jw
EE Cleanup Volunteer
0
Computer101Commented:
PAQed, with points refunded (350)

Computer101
E-E Admin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.