Click to See Complete Forum and Search --> : PHP 4's socket() function on Windows


Anon
11-10-2000, 09:34 PM
I tried to use socket() function in my test program for communicating with other computer using TCP or UDP on Windows.
But my test program couldn't run because an error 'Call to undefined function ...' occured.
I guess that socket() function is not supported in current version of php(4.0.3). Is it right?

If there is a library like php_socket.dll in distributed php module, tell me what library includes socket(), listen()... functions.

Have a nice day ....

Anon
11-18-2000, 07:39 PM
Depending on your Windows system, you won't be able to do socket functions as non-NT Windows platforms don't support socket creation.
I figured this out when I attempted to get a PERL script that builds sockets to run on my Win98 test system. After much searching on the subject I found this lil nugget of information out.
So... if you're running Win95/98 and probably ME, you will not be able to create sockets thanks to the OS... I'd suggest upgrading to Win2k Server (that's what I did) if that's realistisc for you. If your system has 128 megs of RAM it'll work fine (even 96 would probably cut it).

Anon
12-06-2000, 04:49 AM
I tried using the socket() function on the following two servers:

Windows NT 4 Server SP6a
IIS4
PHP 4.0.3pl1

Windows 2000 Professional
OmniHTTPd
PHP 4.0.3pl1

I get the "undefined function" error message on both machines (and currently I can't access PHP.net to view their bug-list)

-Sean

Anon
12-06-2000, 02:22 PM
You can use sockets via PERL. I've done it many times, so I know the problem is not the Windows OS, but rather PHP.

It simply doesn't seem to be a function that's included in the Windows version of PHP.

Anon
12-06-2000, 03:17 PM
Will this allow me to setup a server based in PHP? I can do the client-side coding with fsockopen() but am ready to move on to servers.

I have no experience in PERL and not really certain where to start. Is it similiar to PHP?

Anon
01-21-2001, 06:57 PM
The only thing you need is a version of php with the --enable-sockets switch compiled.

Anon
01-22-2001, 09:54 AM
Is that for Win32 or for *nix platforms? I've read the documents and have seen that command, but it states it's for *nix platforms. Also, I downloaded the source code and checked the sockets directory, but there was nothing for Win32 builds.

I guess all of us Win32 users will just have to wait, or switch back to ASP (ick) to do anything socket related, but I do not feel like spending resources on re-learning ASP and having something that's not portable.

If anyone has a version of PHP for Win32 with socket support, please let us know and perhaps allow us to download it. ^_^

Anon
06-19-2002, 11:24 PM
I'm a PHP beginer.
Perl program use "use socket" but i don't know the same way in PHP.
Can you show me the way to config PHP to use socket?
Thanks

Torben Hardt wrote:
-------------------------------
The only thing you need is a version of php with the --enable-sockets switch compiled.