Ubuntu 18.04 with PHP-7.2
wget https://pecl.php.net/get/oci8-2.2.0.tgz
tar -zxvf oci8-2.2.0.tgz
sudo apt-get -y install alien libaio1
sudo alien oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
sudo alien oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
sudo alien oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
sudo dpkg -i oracle-instantclient18.3-basic_18.3.0.0.0-2_amd64.deb
sudo dpkg -i oracle-instantclient18.3-devel_18.3.0.0.0-2_amd64.deb
sudo dpkg -i oracle-instantclient18.3-sqlplus_18.3.0.0.0-2_amd64.deb
cd oci8-2.2.0
phpize
./configure
make && sudo make install
sudo sh -c "echo extension=oci8.so > /etc/php/7.2/mods-available/oracle.ini"
sudo ln -s /etc/php/7.2/mods-available/oracle.ini /etc/php/7.2/cli/conf.d/20-oracle.ini
sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle.conf"
sudo ldconfig
php -m|grep oci //oci8
如果提示PHP Startup: Unable to load dynamic library 'oci8.so'
要么是没有启用oci8扩展,要么就是没有对Oracle的驱动路径做正确配置(最后一段代码)。
网友评论