In order to add socket support with PHP you need just to include it into your configure string: there is no need to install any third-party applications or software. All you need is to recompile PHP, and it can be done in some minutes.
First of all you need to know where your PHP installation is located. I think you already have it installed if you are going to add some functions. Try searching for your PHP package (I mean installing PHP from source in this article) at your server: it should exist.
When you have the package near and know where it is located, you should identify your current configuration to avoid deleting some elements from the configure line. The most useful method is to copy your current configure line from the output produced by phpinfo(); You may create a new file containing just these lines:
Then run it using a web browser. At the beginning of this output you should see a configure line: it should look like:
'./configure' '--with-apxs2' '--with-curl=/usr/local/lib' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-mbstring' '--enable-pcntl'
Copy it to your text editor and remove quotes and apostrophes. Then add ‘–enable-sockets’ to this line: that’s the only string we need to enable socket support.
Then we need to make PHP. If you’re doing it for the first time, see my previous post: How to configure PHP .
The command is simple enough: make :).
I’d suggest you to make clean before doing make to avoid some possible errors. After the PHP is “made” you need to make install and then to reboot Apache or any web server you might have to see the changes.
make clean; make install; service httpd restart;
If everything went OK, you should see that socket functions are now available.