Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-03-09
12
Medium Priority
?
1,923 Views
Last Modified: 2013-12-12
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
0
Comment
Question by:alfabetman
  • 4
  • 2
  • 2
  • +4
12 Comments
 
LVL 6

Expert Comment

by:carchitect
ID: 8104520
$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
 

Author Comment

by:alfabetman
ID: 8104867
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
 
LVL 6

Expert Comment

by:carchitect
ID: 8104943
sorry wrong folder for files
put your files in wwwroot folder ...
c:\inetpub\wwwroot\orion\web-applications\..\index.php

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:alfabetman
ID: 8105912
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
 

Author Comment

by:alfabetman
ID: 8105941
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 8111473
Can you run <?php phpinfo(); ?> and see what mysql/odbc support is provided by PHP.

Richard.
0
 
LVL 14

Expert Comment

by:psadac
ID: 8113676
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
 
LVL 1

Expert Comment

by:splishsplash
ID: 8117447
..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
 

Author Comment

by:alfabetman
ID: 8118822
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 8120787
Ho hum!
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9682591
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
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9724992
PAQed, with points refunded (350)

Computer101
E-E Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question