Am avut nevoie zilele acestea de extensia Oracle in PHP, pe un MacOS X 64bit cu XAMPP. Primele incercari de instalare a extensiei via pecl
au esuat din cauza bibliotecilor compilate pentru 64bit iar XAMPP-ul avea nevoie de 32, asa ca a trebuit purces la lucru manual.
Dupa download-ul pachetelor basic si sdk ale Instant Client de la Oracle, le-am despachetat in /usr/lib/oracle
si am creat doua symlink-uri in structura urmatoare:
bash-3.2# ls -al /usr/lib/oracle/10.2.0.4/ total 196144 drwxr-xr-x 15 root wheel 510 5 Mai 11:36 . drwxr-xr-x 3 root wheel 102 5 Mai 11:24 .. -rw-r--r-- 1 root wheel 278 1 Apr 2009 BASIC_README -r--r--r-- 1 root wheel 1609607 2 Feb 2008 classes12.jar -rwxr-xr-x 1 root wheel 30556 1 Apr 2009 genezi lrwxr-xr-x 1 root wheel 20 5 Mai 11:36 libclntsh.dylib -> libclntsh.dylib.10.1 -rwxr-xr-x 1 root wheel 21537536 31 Mar 2009 libclntsh.dylib.10.1 -rwxr-xr-x 1 root wheel 1683924 12 Feb 2009 libnnz10.dylib lrwxr-xr-x 1 root wheel 18 5 Mai 11:36 libocci.dylib -> libocci.dylib.10.1 -rwxr-xr-x 1 root wheel 1142284 12 Feb 2009 libocci.dylib.10.1 -rwxr-xr-x 1 root wheel 72626824 1 Apr 2009 libociei.dylib -rwxr-xr-x 1 root wheel 106184 25 Mar 2009 libocijdbc10.dylib -rwxr-xr-x 1 root wheel 106184 25 Mar 2009 libocijdbc10.jnilib -r--r--r-- 1 root wheel 1555682 2 Feb 2008 ojdbc14.jar drwxr-xr-x 7 root wheel 238 1 Apr 2009 sdk
Dupa un pecl download oci8
si despachetarea arhivei, a urmat un /Applications/XAMPP/xamppfiles/bin/phpize-5.3.0
in directorul respectiv, apoi un configure cu:
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.0 --with-oci8=instantclient,/usr/lib/oracle/10.2.0.4/
make && make install
Ne asiguram ca biblioteca are arhitectura corecta:
bash-3.2# cd /Applications/XAMPP/xamppfiles/lib/php/php-5.3.0/extensions/no-debug-non-zts-20090626/ bash-3.2# file mysql.so mysql.so: Mach-O universal binary with 2 architectures mysql.so (for architecture i386): Mach-O bundle i386 mysql.so (for architecture ppc): Mach-O bundle ppc bash-3.2# file oci8.so oci8.so: Mach-O universal binary with 2 architectures oci8.so (for architecture i386): Mach-O bundle i386 oci8.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
Am adaugat in /Applications/XAMPP/etc/php.ini
:
extension=oci8.so
Iar in /Applications/XAMPP/xamppfiles/bin/envvars
:
DYLD_LIBRARY_PATH="/Applications/XAMPP/xamppfiles/lib:/usr/lib/oracle/10.2.0.4:$DYLD_LIBRARY_PATH" export DYLD_LIBRARY_PATH ORACLE_PATH=/usr/lib/oracle/10.2.0.4 export SQLPATH="${ORACLE_PATH}" export TNS_ADMIN="${ORACLE_PATH}" export ORACLE_HOME="${ORACLE_PATH}" export NLS_LANG="AMERICAN_AMERICA.UTF8"
Un restart Apache si PHP stie in sfarsit sa vorbeasca cu Oracle.