Re: 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]

 



On Thu, Nov 4, 2010 at 11:11 AM, Suyash R <r.suyash@xxxxxxxxx> wrote:

> On Tue, Nov 2, 2010 at 5:49 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx>wrote:
>
>> On Tue, Nov 2, 2010 at 2:33 PM, Suyash R <r.suyash@xxxxxxxxx> 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

[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