How to add pcntl extensions to php in Linux
This article mainly shows you the "Linux php how to add pcntl extension", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Linux php how to add pcntl extension" this article.
Pcntl extension can support multithreaded operation of php (linux systems only)
There are two ways to load pcntl
A recompile installation that is added at compile time, configrue prompt plus-- enable-pcntl
. / configure-- prefix=/usr/local/php-- with-mysql=/usr/local/mysql-- with-apxs2=/usr/local/apache/bin/apxs-- enable-pcntl another extra mount
Since my php is installed using yum, I cannot use the first method
Here is a way for php to add extensions dynamically, phpize.
1. First take a look at the directory where the phpize command is located (my directory / usr/bin/phpize)
Perform the installation if it is not found
Yum install php53_devel (please pay attention to your version)
After the installation. A phpize command is generated
2. Go to php.net to download the corresponding version of the php source file
Http://php.net/releases/index.php
Let's take php-5.3.17 as an example. After decompression, enter the corresponding module.
Cd / php-5.3.17/ext/pcntl
# execute phpize first
/ usr/bin/phpize
. / configure-- with-php-config=/usr/bin/php-config (please specify the directory of php-config correctly)
# compile and install
Make & & make install
A mistake was made at this time.
. / configure compilation is normal, but make error
Error: 'PHP_FE_END' undeclared here (not in a function)
Solution:
There is an error in the source code. Enter the php-5.3.17 directory.
Sed-I's | PHP_FE_END | {NULL,NULL,NULL} |'. / ext/**/*.c
Sed-I's | ZEND_MOD_END | {NULL,NULL,NULL} |'. / ext/**/*.c
Make & & make install again
3. After compilation, a pcntl.so file will be generated. In the model directory of php
Cd / root/php-5.3.17/ext/pcntl/modules
Ls-l pcntl.so
-rwxr-xr-x 1 root root 82375 April 1 11:38 pcntl.so
Edit / etc/php.ini, join
Extension=pcntl.so
4. Restart apache and php
Service httpd restart
/ etc/init.d/php-fpm restart
5. Test whether the installation is successful
Write a php homepage file in the webpage directory as follows
Output: 23165 proves that the installation is successful
These are all the contents of the article "how to add pcntl extensions to php in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!