Jump to content

socket_create() generating error, but PHP was compiled with socket support.


Recommended Posts

I moved one of my scripts over to a new machine. It requires a special compilation of PHP with socket support and a couple other things. I had it working fine on the old machine, but this one appears to be having troubles for some reason. I compiled and installed PHP with the required extensions.

 

When I run my script, I get the following error:

PHP Fatal error:  Call to undefined function socket_create() in /home/danny/projects/PHPChatServ/ChatServ.php on line 379

 

Here is the "Configure Command" section of my phpinfo() showing that it was indeed compiled with the --enable-sockets option:

 

Configure Command =>  './configure'  '--srcdir=../php-5.3.2' '--prefix=/usr' '--sysconfdir=/etc/php' '--with-layout=GNU' '--with-config-file-path=/etc/php' '--with-config-file-scan-dir=/etc/php/conf.d' '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--disable-static' '--enable-shared' '--mandir=/usr/share/man' '--without-pear' '--disable-cgi' '--with-readline' '--enable-pcntl' '--enable-bcmath=shared' '--enable-calendar=shared' '--enable-sockets' '--enable-pcntl' '--enable-dba=shared' '--enable-exif=shared' '--enable-ftp=shared' '--enable-gd-native-ttf' '--enable-intl=shared' '--enable-json=shared' '--enable-mbregex' '--enable-mbstring' '--enable-pdo=shared' '--enable-phar=shared' '--enable-posix=shared' '--enable-session' '--enable-shmop=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-sqlite-utf8' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-xml' '--enable-zip=shared' '--with-bz2=shared' '--with-curl=shared' '--with-db4=shared' '--with-enchant=shared,/usr' '--with-freetype-dir=shared,/usr' '--with-gd=shared,/usr' '--with-gdbm=shared' '--with-gettext=shared' '--with-gmp=shared' '--with-iconv=shared' '--with-icu-dir=/usr' '--with-imap-ssl=shared' '--with-imap=shared' '--with-jpeg-dir=shared,/usr' '--with-ldap=shared' '--with-ldap-sasl' '--with-mcrypt=shared' '--with-mhash' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysql=shared,mysqlnd' '--with-mysqli=shared,mysqlnd' '--with-openssl=shared' '--with-pcre-regex=/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared,/usr' '--with-pgsql=shared' '--with-png-dir=shared,/usr' '--with-pspell=shared' '--with-regex=php' '--with-snmp=shared' '--with-sqlite3=shared,/usr' '--with-sqlite=shared' '--with-tidy=shared' '--with-unixODBC=shared,/usr' '--with-xmlrpc=shared' '--with-xsl=shared' '--with-zlib' '--without-db2' '--without-db3'

 

What gives?

http://us2.php.net/manual/en/sockets.installation.php

 

Check out the installation document.

 

You need to also enable the extension in the php.ini file.

 

That's strange, I don't remember having to do that before.

 

Oh well. The instructions in that link were for Windows but the procedure for Linux is similar. It works now, thanks :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.