Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

socket_create() Error

Status
Not open for further replies.

Nos4aTu

Programmer
Oct 19, 2006
4
GB
i am running an apache server on windows

i have just started at looking at sockets, when i tried this script for php:
Code:
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($socket,'localhost',1337);
socket_listen($socket);
while($connection = socket_accept($socket))
{
socket_write($connection,'You\'ve successfully connected to my computer!\r\n');
}
?>

i get this error:

Fatal error: Call to undefined function socket_create() in C:\Server\Apache Group\Apache\htdocs\01.php on line 2

i have enabled (extension=php_sockets.dll)in php.ini
 
Run a script that consists entirely of:

<?php
phpinfo();
?>

Does the output of the script have a section titled "sockets"? If not, PHP may be having trouble finding the DLL.



Want the best answers? Ask the best questions! TANSTAAFL!
 
and have you remembered to restart your webserver after editing php.ini (assuming you are running as a sapi).
 
There is no section in phpinfo() about sockets.
any idea how i can fix this problem?

the extension folder is the right one, the .dll is there but i dont have a clue why it isnt seeing it
 
I know it's kind of a "stupid" question
but anyway... Did you think about uncommenting that DLL? :)
 
are you certain that the php.ini you uncommented the dll in is the php.ini being addressed by your web application? you can rule out this (not uncommon) bug by checking phpinfo() for the location of the php.ini file.
 
Jpadie has a good point pending on server environment there could be many php.ini that are symlinks.
 
thanks for that jpadie i forgot that the php.ini file was in a different place than it normaly is...

thanks
Nos4aTu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top