473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Playing with PHP socket extension dll - not working.

I am trying to play with sockets.

using Windows XP - SP2
IIS
PHP 5.2.3

I have searched online for this error message and I have tried the various suggestions, so now I have run out of things to try.

So far I have:
1) uncommented extension=php_sockets.dll in php.ini
2) made sure that the above dll file is physically in the extension_dir (C:/PHP5/ext)
3) restarted IIS service after changing php.ini
4) made sure the php.ini that I am editing, is the one mentioned in the php_info in Loaded Configuration File item.

php_info does not show major heading about sockets like it does with gd, or mssql - all it finds when I search for 'socket' on the php-info page is

registered stream socket transports - tcp, udp
default_socket_timeout - 60

Should I see anything else if the socket extension is loaded?

and still I get the following error:
Fatal error: Call to undefined function socket_create() in ........ line .....

My php code copied from the manual page (changed host to localhost) to test this is:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.  
  4. // set some variables
  5. $host = "127.0.0.1";
  6. $port = 12345;
  7. echo "127.0.0.1 12345<BR>";
  8. set_time_limit(0);
  9.  
  10. // create socket
  11. $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n");
  12. socket_close($socket);
  13. echo "*** DONE ***";
  14. exit;
  15.  
So, can anyone think of anything else I can try please?

Thanks,
Paul
Sep 3 '07 #1
2 5677
In the php.ini I have just enabled the error_log switch and in the log I found this. It was NOT being displayed on the screen as an error message before I did this, probably because it is only a warning.

PHP Warning: PHP Startup: sockets: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=1
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0

This API= ..... looks like a date, so -
Does this mean I have the wrong version of sockets.dll ?

More information found on this.

Now found this reply to a similar bug report on PHP and it looks like I am finding the answer to this one.

Someone said.....
You are mixing modules from different versions of PHP.
That won't work and that's expected.

So I will go away and try this. It is true that I did copy the sockets.dll from a previous version of php so it it might well be this is the answer. Hope this helps others too.


================================================== ======
OK, so I have re-run the PHP installation and added the sockets part from the 5.2.3 PHP version and it now works fine.

---------------------------------------
****** RESOLVED *********
--------------------------------------
Sep 3 '07 #2
pbmods
5,821 Expert 4TB
Heya, Paul.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sep 3 '07 #3

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

Similar topics

1
by: Chuck E. Cheese | last post by:
I need a php page to connect to a python created socket and sent and receive data. below is the python code which opens a socket on the localhost @ port 21567: #!/usr/bin/python2 from socket...
7
by: Martin | last post by:
I am a PHP newbie (just got my "Hello World" page working this morning). I'm doing some R&D work to see if PHP is viable for a situation I have. To accomplish what I want to do, I have to have the...
4
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
0
by: didifouke | last post by:
Hi, I try to sample and playback speech using snack. My idea is to have a socket based server that plays back the sound and a client that samples the input from the sound card and sends it to...
2
by: Dave | last post by:
Hi, I am writing a c# application that using a directshow to play file and display it on my C# gui, its work just fine but when i try to open another thread in my c# application the file stop...
2
by: giangiammy | last post by:
hi all, I'd like to implement a server socket in java: something linke the following example. The problem is that the HTML has not the permission to execute instruction serverSocket =...
1
by: bobano | last post by:
Hi everyone, I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol....
16
by: =?iso-8859-1?q?|-|e|=5F|=5F_B0=DD?= | last post by:
hi all! I got a problem. I declared a SOCKET var in my C program but when i compiled the program it displayed like *--------------------------------------------------------------* *'SOCKET':...
1
by: josephChiaWY | last post by:
Hi all, Recently, i have met a problem in playing the selected video in the embedded quicktime player. I am creating a video gallery for people to view their .mov file on quicktime player. Below...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.