PHP sockets enabled but socket_create() gives an error call to undefined function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I was trying to create a socket connection from a Solaris machine to a Red
Hat machine  to get the PATH in Red Hat machine remotely on Solaris machine
and display it to the user.

We have a PHP 5.1.6 installation on a Linux server (Apache) and PHP 5.2.6.
on a Unix(Solaris) server(Apache) . The PHP version on Solaris is compiled
with --enable sockets and phpinfo() displays that the sockets are enabled.
In spite of this we get the following error when using this piece of code
from the Solaris machine.


The error:

PHP Fatal error:  Call to undefined function socket_create() in /XXX/
5server.php<http://cad.njit.edu/u/d/x/dx8/public_html/clunk/swsearch5server.php>
on
line 21

The code;

<?php

set_time_limit(0);

//ip of the server
$addr = 'xxx.xxx.xxx.xxx';

//port of the server
$port = 2xxx;

//create a socket
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);  /* This is line no 21
in the code. i have ommitted a few header comments */

//bind this socket with the above ip and port
$ret = socket_bind($sock, $addr, $port);

do {
    $ret = socket_listen($sock, 10);
    $msgSock = socket_accept($sock);
    $buf = socket_read($msgSock, 1024);


Please let me know if you need any further details I might have missed.

Thank you.

Suyash Ramineni

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux