?
Solved

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

Posted on 2003-03-09
12
Medium Priority
?
1,791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Technology Partners: 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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

777 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