Because you want to operate Oracle database with PHP on CentOS, you need to install a new PHP extension oci8.
Regarding the installation of PHP extensions, I used to think that I needed to recompile PHP. Today, I checked a lot of information and found that it can be dynamically extended like an apache module. Take oci8 as an example today.
1. Enter the source code directory of the extension to be installed (if not, go to the official download source code)
# cd /root/php-5.5.35/ext/oci8
Run phpize, if you don't know which directory phpize is in, you can run the # which phpize command
# /usr/bin/phpize # The following errors may occur at this step
Literally, you may not have installed the php-devel extension package.
phpize is used to extend the php extension module. Through phpize, you can build a php plug-in module. phpize is the content of php-devel
, so just run yum install php-devel
# yum install php-devel # The following prompt appears
# yum install php-devel # The following prompt appears
This means that the default phpize in the repository is inconsistent with the PHP version. As can be seen from the following command: php-devel version is 5.3.3. This requires us to reinstall phpize .
Install php-devel consistent with the current PHP version. The PHP version can be checked with php -v.
So you can install php-devel corresponding to the current system PHP. Run yum install php55w-devel The following information appears, the installation is successful.
2. Run /usr/bin/phpize and the following information appears, indicating that it is ok.
# ./configure --with-php-config=/usr/bin/php-config
# make
# make install
After installation there will be something like this, Installing shared extensions: /usr/lib64/php/modules . It means that the system has installed the oci8.so module in the /usr/lib64/php/modules directory by default.
Third, modify php.ini
# vi /etc/php.ini
Regarding PHP extensions, you can view them through phpinfo();.
Fourth, restart Apache
Original link: http://woqilin.blogspot.com/2016/05/linux-phpize-php.html