The common problem of using PHP is: Compile PHP forgot to join an extension, and then want to join the extension, but because the installation of PHP and then installed something such as pear, do not want to remove the folder reload, then you need to add a module once again support, Linux operating system under the ability to use Phpize to dynamically add extensions to PHP. The following is an example of extension module oci8 (PHP connection to Oracle database needs to be extended support) to do a simple explanation. (All resources below will be able to access the http://download.csdn.net/detail/haiqiao_2010/8294513 for a unified download)
1. Download the Oracle client package including OCI, Occi, Jdbc-oci and other related files? 1.1 According to the Linux system to select the appropriate software, my 32-bit system, the following files such as:
oracle-instantclient11.2-basic-11.2.0.3.0-1.i386.rpm
oracle-instantclient11.2-devel-11.2.0.3.0-1.i386.rpm
1.2:?http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html (user is required to download Oracle website)
2. To install the Oracle client, execute the following command:
RPM-IVH oracle-instantclient11.2-basic-11.2.0.3.0.i386.rpm
RPM-IVH oracle-instantclient11.2-devel-11.2.0.3.0.i386.rpm
3. Installing the oci8 PHP extension
3.1 Download oci8-1.4.10.tgz?
: http://pecl.php.net/get/oci8-1.4.10.tgz
3.2 Upload the download file to Linuxserver and unzip it
Command: Tar zxvf oci8-1.4.10.tgz#解压
3.3 Go to Unzip folder
command: CD oci8-1.4.10
3.4 use Phpize to prepare the compiler environment for the PHP plug-in module. Generates the makefile required at compile time based on the specified environment variables. Phpize is the content belonging to Php-devel. So under CentOS only to perform the Yum install Php-devel installation can ( Note: /usr/local/php/bin/phpize for my Php folder, the difference will need to change the )
/usr/local/php/bin/phpize cflags= "-i/usr/lib/oracle/11.1/client" cxxflags= "-i/usr/lib/oracle/11.1/client"
3.5 Compiling, installing
You should have the same PHP compression package as the existing PHP.
I'm using a php-5.5.3.tar.gz. Expand and enter the inside of the Ext/oci8 folder,
Then execute the command:/usr/local/php/bin/phpize #这是一个可执行的文本文件 to make sure it is in the system
You will find some more configure files under the current folder.
Assuming that there is no error, execute the order;
./configure--with-php-config=/usr/local/php/bin/php-config--with-oci8=/usr/lib/oracle/11.1/client
Be careful to make sure that/usr/local/php/bin/php-config exists first. If your PHP installation path is not the default, change it.
Then execute the following command, and then it tells you a folder where you copy the oci8.so under the folder to the folder in the Extension_dir point of your php.ini
Make?
Make install
Need to emphasize is make when the error, display a variety of library files can not be found, need to make changes to the makefile file to join Oralce's execution library address
Open makefile, look for include, form such as the following:
Includes =-i/usr/local/php/include/php-i/usr/include/oracle/10.2.0.3/client
Then add = "-i/usr/lib/oracle/11.1/client at the end. And then make will succeed again.
4. Change PHP.ini (/usr/local/php/etc/php.ini)
Add a line after Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/":
extension = "oci8.so"
Note: To make sure that there are oci8.so files under the/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/folder
5. Restart Apache for OCI to take effect 6. Create a phpinfo.php file under the Web folder and type in the contents. And through the Web interview
<?phpphpinfo ();? >
Assuming that the OCI8 section is found, the OCI is installed properly. For example, as seen in the
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvagfpcwlhb18ymdew/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "/>
Instructions OCI8 successfully installed, then you will be able to access the Oracle database using PHP
Linux under PHP enable Oracle Support (OCI8)