How to install socket extension for php: 1. Execute the [make&make install] command to compile and install; 2. Edit the php.ini configuration file and enable [extension=sockets.so]; 3. Restart apache.
First compile and install
(Recommended tutorial: php video tutorial)
#cd /home/php5.2.1/ext/sockets #/server/php/bin/phpize #./configure --prefix=/usr/local/php/lib --with-php-config=/server/php/bin/php-config --enable-sockets #make #make install
Then modify /usr/local/php/etc/php.ini file
#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/" (php5.4版本以上不用加扩展路径) extension=sockets.so
Finally restart apache
Note:
Perform /usr/ in the directory of the PHP module that requires extended compilation local/php/bin/phpize Otherwise, an error will be reported.
Related recommendations: php training
The above is the detailed content of How to install socket extension for php. For more information, please follow other related articles on the PHP Chinese website!