First confirm: when we installed PHP, we specified its installation directory: --prefix=/var/lib/php5; and the directory /home/guanli/php-5.4.9 is after we decompressed .tar.gz The path, that is, the source code path.
For example, install the bcmath module
# cd /home/guanli/php-5.4.9/ext
# cd openssl
#mv vonfig0.m4 config.m4
# cd -
# cd bcmath
# /var/lib/php5/bin/phpize
An error message is displayed at this time:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
# yum install autoconf
#/var/lib/php5/bin/phpize
# ./configure --with-php-config=/var/lib/php5/bin/php-config
# make
# make test
# make install
After execution, we will automatically be prompted to add the bcmath.so module to the path: /var/lib/php5/lib/php/extensions/no-debug-non-zts-20100525
Next, set the extension directory in php.ini:
If the location of the configuration file is not specified when compiling PHP, the default php.ini should be placed under /var/lib/php5/lib before it can be loaded. This has been discussed elsewhere.
We find ; extension_dir = "./", cancel the previous comment and change it to:
extension_dir = "/var/lib/php5/lib/php/extensions/no-debug-non-zts-20100525"
Add extension module reference again
extension = bcmath.so
At this point, restart the httpd service and verify through phpinfo() that the bcmath module has been successfully loaded.