Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
We added the extension=sockets.so to php.ini but it didn't work. However, the problem was there was no sockets.so extension anywhere to be found. i searched if I could install or add sockets.so extension. Couldn't find anything. Still looking for it. Thank you for all the help. -Suyash On Tue, Nov 2, 2010 at 5:30 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 2, 2010, at 3:23 PM, Suyash R wrote: No, our dept.'s admin wants to know where is sockets.so file on disk and why should we try this when the phpinfo() displays sockets being enabled? Can help me find sockets.so file I don't know where it is It's a shared object right are they stored on disk as individual files or all together compiled into a binary Thank you Suyash Ramineni On Tue, Nov 2, 2010 at 3:55 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 2, 2010, at 2:50 PM, Suyash R wrote: My admin disagrees and I have questions too. The phpinfo() fuction displays that sockets have been enabled. If extension=sockets.so is an alternate way to enable sockets, then why should this be done twice? Suyash Ramineni On Mon, Nov 1, 2010 at 2:35 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 1:12 PM, Suyash R wrote: No, sockets.so in not included in any of the machines php.ini file. However, I found that Linux machine's php.ini doesn't include sockets.so and sockets work fine on it but don't work on the Solaris machine. Is it required to be included only in Solaris? On Mon, Nov 1, 2010 at 1:41 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 12:08 PM, crrr errr wrote: Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Oops, included in php.ini, not the Apache config. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Since you complied with --enable-sockets, you shouldn't even need sockets.so to be dynamically loaded. But at this point, it is something that I would try anyway. Add: extension=sockets.so in your php.ini file just to see if it brings the function to light. Your Linux installs I am sure were compiled with it in it. Especially if it is a dist package. The absence of the function is telling me that PHP is not compiled with --enable-sockets. If it was compiled in properly, you would be getting different errors. I am not saying that you didn't do it. Something may have happened in
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Tue, Nov 2, 2010 at 5:49 PM, Nathan Nobbe quickshif...@gmail.com wrote: On Tue, Nov 2, 2010 at 2:33 PM, Suyash R r.suy...@gmail.com wrote: No, we didn't try it our dept.'s admin wants to know where is sockets.so file on disk lol, tell your dept.'s 'admin' to run locate sockets.so yeah he couldn't find it either. He mentioned it's not in the php extensions so I am looking for way to install it or add it. and why should we try this when the phpinfo() displays sockets being enabled? probly there is no need to, however you should understand the difference between adding support for and enabling an extension. compiling w/ --enable only makes the extension available. the extension is not enabled unless you do what Nick has been saying. (there are other options as well actually). there may be other files aside from php.ini where this setting is made, depending on how the OS vendors package up the code. for example using mac ports, i just installed sockets and now have a shiny new sockets.ini file. anyway if phpinfo() shows that sockets are enabled you probly don't have to worry about that, because it wouldn't be showing up otherwise (essentially). i'm wondering if you're trying to call socket_create() from the same place you're running phpinfo(). are you sure the socket_create() code isn't running from the cli perhaps? yes to see the errors we ran it at cli. The browser page with sockets code is just blank. if so, a quick test to see if sockets are enabled on the cli is php -i | grep 'Sockets Support' Yeah, this gives no results. Hence, I think sockets are not enabled yet as sockets.so is missing. if nothing comes back sockets aren't enabled for the cli. if that's the case then you will have to head into the appropriate ini file to enable the extension for the cli. or if that's too much for you admin you can always try dl('sockets.so'); at the top of your script. you can also try var_dump(extension_loaded('sockets')); When I add this line (dl('sockets.so');) to the top of my script I get the following error: PHP Warning: dl(): Unable to load dynamic library './sockets.so' - ld.so.1: php: fatal: ./sockets.so: open failed: No such file or directory in //r.php on line 2 PHP Fatal error: Call to undefined function socket_create() in /.r.php on line 24 When I add this line (var_dump(extension_loaded('sockets'));) to the top of my script: bool(false) PHP Fatal error: Call to undefined function socket_create() in /../r.php on line 24 to see if sockets are actually enabled where you're trying to invoke them from. -nathan Can I get any help on how to add or install sockets.so to the php extensions... -Suyash
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Thu, Nov 4, 2010 at 11:11 AM, Suyash R r.suy...@gmail.com wrote: On Tue, Nov 2, 2010 at 5:49 PM, Nathan Nobbe quickshif...@gmail.comwrote: On Tue, Nov 2, 2010 at 2:33 PM, Suyash R r.suy...@gmail.com wrote: No, we didn't try it our dept.'s admin wants to know where is sockets.so file on disk lol, tell your dept.'s 'admin' to run locate sockets.so yeah he couldn't find it either. He mentioned it's not in the php extensions so I am looking for way to install it or add it. you may need to update the locate database. this is typically done w/ the updatedb command. and why should we try this when the phpinfo() displays sockets being enabled? probly there is no need to, however you should understand the difference between adding support for and enabling an extension. compiling w/ --enable only makes the extension available. the extension is not enabled unless you do what Nick has been saying. (there are other options as well actually). there may be other files aside from php.ini where this setting is made, depending on how the OS vendors package up the code. for example using mac ports, i just installed sockets and now have a shiny new sockets.ini file. anyway if phpinfo() shows that sockets are enabled you probly don't have to worry about that, because it wouldn't be showing up otherwise (essentially). i'm wondering if you're trying to call socket_create() from the same place you're running phpinfo(). are you sure the socket_create() code isn't running from the cli perhaps? yes to see the errors we ran it at cli. The browser page with sockets code is just blank. right, well if your report from the other day is accurate then it sounds like you have sockets setup in the web environment and not the cli. if the browser page is blank it could be b/c your not outputting anything from your script to the browser. if so, a quick test to see if sockets are enabled on the cli is php -i | grep 'Sockets Support' Yeah, this gives no results. Hence, I think sockets are not enabled yet as sockets.so is missing. run updatedb first before running locate and see if it's there or not. im not sure how phpinfo() could possibly have reported sockets as being enabled if you were missing sockets.so. if nothing comes back sockets aren't enabled for the cli. if that's the case then you will have to head into the appropriate ini file to enable the extension for the cli. or if that's too much for you admin you can always try dl('sockets.so'); at the top of your script. you can also try var_dump(extension_loaded('sockets')); When I add this line (dl('sockets.so');) to the top of my script I get the following error: PHP Warning: dl(): Unable to load dynamic library './sockets.so' - ld.so.1: php: fatal: ./sockets.so: open failed: No such file or directory in //r.php on line 2 PHP Fatal error: Call to undefined function socket_create() in /.r.php on line 24 When I add this line (var_dump(extension_loaded('sockets'));) to the top of my script: bool(false) PHP Fatal error: Call to undefined function socket_create() in /../r.php on line 24 so it's def not enabled on the cli. to see if sockets are actually enabled where you're trying to invoke them from. -nathan Can I get any help on how to add or install sockets.so to the php extensions... im not much for red hat, do they even use yum on that system or is it still rpm? on a centos box we have a quick search turns up a sockets package, however if you built from source, i doubt that's how you want to install sockets support at this point. $ yum search php | grep -i socket php-pear-Net-Socket.noarch : Network Socket Interface also dude, it sounds like your admin is struggling... these questions are the sort an admin would be expected to answer pretty much anywhere ive ever worked. like, how do i install software on the os im responsible for .. OUCH! -nathan
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Thu, Nov 4, 2010 at 11:43 AM, Nathan Nobbe quickshif...@gmail.comwrote: $ yum search php | grep -i socket php-pear-Net-Socket.noarch : Network Socket Interface check that - thats def *not* the package you're looking for, it's a userspace oo wrapper. you'd be best asking how to install this software on some sort of red hat / php list really. like i said, i tend to stay away from red hat. the gentoo guys have #gentoo-php on irc so i would expect there to be similar channels for other distros. still though, update the locate database and see if you just need to enable sockets in a cli specific ini file. -nathan
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Thu, 2010-11-04 at 11:48 -0600, Nathan Nobbe wrote: On Thu, Nov 4, 2010 at 11:43 AM, Nathan Nobbe quickshif...@gmail.comwrote: $ yum search php | grep -i socket php-pear-Net-Socket.noarch : Network Socket Interface check that - thats def *not* the package you're looking for, it's a userspace oo wrapper. you'd be best asking how to install this software on some sort of red hat / php list really. like i said, i tend to stay away from red hat. the gentoo guys have #gentoo-php on irc so i would expect there to be similar channels for other distros. still though, update the locate database and see if you just need to enable sockets in a cli specific ini file. -nathan is there a PEAR module you can install that will do this? I know there are a lot of PEAR modules out there... just a thought... Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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.phphttp://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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.comwrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Nov 1, 2010, at 12:08 PM, crrr errr wrote: Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Are you including sockets.so in Apache config?
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Nov 1, 2010, at 12:08 PM, crrr errr wrote: Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.comwrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Oops, included in php.ini, not the Apache config. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
No, sockets.so in not included in any of the machines php.ini file. However, I found that Linux machine's php.ini doesn't include sockets.so and sockets work fine on it but don't work on the Solaris machine. Is it required to be included only in Solaris? On Mon, Nov 1, 2010 at 1:41 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 12:08 PM, crrr errr wrote: Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Oops, included in php.ini, not the Apache config. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function
On Nov 1, 2010, at 1:12 PM, Suyash R wrote: No, sockets.so in not included in any of the machines php.ini file. However, I found that Linux machine's php.ini doesn't include sockets.so and sockets work fine on it but don't work on the Solaris machine. Is it required to be included only in Solaris? On Mon, Nov 1, 2010 at 1:41 PM, Nicholas Kell n...@monkeyknight.com wrote: On Nov 1, 2010, at 12:08 PM, crrr errr wrote: Yes, the http ( Apache user) has rl ( read permission) on the php file with sockets code in it. I think write access is unnecessary for Apache user. On Mon, Nov 1, 2010 at 12:50 PM, Nicholas Kell n...@monkeyknight.comwrote: On Nov 1, 2010, at 11:44 AM, crrr errr wrote: Yes, the phpinfo() shows that sockets are enabled in both machines. On Mon, Nov 1, 2010 at 12:43 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Nov 1, 2010 at 12:40 PM, crrr errr r.suy...@gmail.com wrote: 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 check phpinfo() to see if the sockets have been activated in the ini file. -- Bastien Cat, the other other white meat I think that I messed up sending my last email, I apologize. Is the user that Apache is running under configured for the proper read write access to the socket file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Oops, included in php.ini, not the Apache config. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Since you complied with --enable-sockets, you shouldn't even need sockets.so to be dynamically loaded. But at this point, it is something that I would try anyway. Add: extension=sockets.so in your php.ini file just to see if it brings the function to light. Your Linux installs I am sure were compiled with it in it. Especially if it is a dist package. The absence of the function is telling me that PHP is not compiled with --enable-sockets. If it was compiled in properly, you would be getting different errors. I am not saying that you didn't do it. Something may have happened in the process. By adding the sockets.so, you are adding the extension dynamically, incase you were mistaken by the compile or incase there was some sort of anomaly that the rest of PHP compiled but the sockets section was botched. Solaris is (I guess) known to be lacking when it comes to C compilers (at least according to the Unix geeks that I sit next to at work). But it seems to me that it would all have failed or it would have all worked.