1

sorry for the bad explanation and bad grammar

➜  project-name php --version
PHP 7.4.16 (cli) (built: Mar  4 2021 12:36:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

and i was trying too with v8

➜  ~ php --version
PHP 8.0.7 (cli) (built: Jun  3 2021 19:10:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies

before i was trying with 3 version of oracle instant, sdk

  • v11.1
  • v12.2
  • v19.8.0.0.0

i was checking my oci its working by running composer require yajra/laravel-oci8:^7 where the command needed oci8.

➜  project-name pa package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: yajra/laravel-oci8
Package manifest generated successfully.

but,,,

when i check on phpinfo() my page is going on 502 Bad Gateway nginx/1.19.8

when i check on oci_error() the response is false thats mean there is no error, right ?.

when i comment ;extension=oci8.so on php.ini and

➜ project-name brew services restart php@7.4

phpinfo() is work but i need oci_connect function .

already tried restart, shutdown laptop , any service like nginx, php, still not solve,

when i check my logs on nginx or valet , there is no error or log

/usr/local/var/log/nginx
/opt/nginx/logs/error.log

my step install oci8 is unzip oracle package (instant,sdk,sqlplus)

sudo ln -s /opt/instantclient_19_8/sdk/include/*.h /usr/local/include/
sudo ln -s /opt/instantclient_19_8/sqlplus /usr/local/bin/
sudo ln -s /opt/instantclient_19_8/*.dylib /usr/local/lib/
sudo ln -s /opt/instantclient_19_8/*.dylib.19.1 /usr/local/lib/
sudo ln -s /usr/local/lib/libocci.dylib.19.1 /usr/local/lib/libocci.dylib
sudo ln -s /usr/local/lib/libclntsh.dylib.19.1 /usr/local/lib/libclntsh.dylib

sudo pecl install oci8-2.2.0 and i was try too with sudo pecl install oci8 for php8 version

my respond of oracle home instantclient,/usr/local/lib

the respond

Build process completed successfully
Installing '/opt/homebrew/Cellar/php@7.4/7.4.16/pecl/20190902/oci8.so'
install ok: channel://pecl.php.net/oci8-2.2.0
Extension oci8 enabled in php.ini

so i change

extension_dir = "/opt/homebrew/Cellar/php@7.4/7.4.16/pecl/20190902"
;extension_dir = "/opt/homebrew/lib/php/20190902"

but in php8 i don't need change the dir.

i run check oci like as what i was check on above.

screenshot when test oci

➜  ~ sudo nginx -t
nginx: the configuration file /opt/homebrew/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /opt/homebrew/etc/nginx/nginx.conf test is successful

when i try check with phpinfo() condition is 502 bad gateway -> check with

<?php
if (oci_connect('xusername', 'xpassword', 'xip/XE', 'xcharset')) {
    print 'right';
} else {
    print 'error';
}
➜  oracle php -q b.php
dyld: lazy symbol binding failed: Symbol not found: _OCIEnvNlsCreate
  Referenced from: /opt/homebrew/lib/php/pecl/20200930/oci8.so
  Expected in: flat namespace

dyld: Symbol not found: _OCIEnvNlsCreate
  Referenced from: /opt/homebrew/lib/php/pecl/20200930/oci8.so
  Expected in: flat namespace

[1]    35993 abort      php -q b.php

by reference on https://theoldape.com/mac-os-x-php-with-oracle-oci8-extension/ its mean wrong os version . hm i have test with instantclient-basic-macos.x64-19.8.0.0.0dbru on my device mbp m1

in https://www.oracle.com/database/technologies/instant-client/downloads.html only Instant Client for macOS (Intel x86) and Instant Client for Mac OS X (PPC)

the problem i have found , its same like on dyld: lazy symbol binding failed for php oic8 on Apple M1

i have solved my phpinfo() with instantclient-sqlplus-macosx-10.1.0.3 (Instant Client for Mac OS X (PPC)) so i can see oci8 table of configuration

then i try php -i i have solved there is no error like as on dyld: lazy symbol binding failed for php oic8 on Apple M1 (dyld: lazy symbol binding failed: Symbol not found: _OCIClientVersion) ,

but when i try ➜ oracle php -q b.php i still get error dyld: lazy symbol binding failed: Symbol not found: _OCIEnvNlsCreate

A_Arnold
  • 3,195
  • 25
  • 39
Yogi Arif Widodo
  • 563
  • 6
  • 22
  • Does command-line PHP work? – Christopher Jones Jun 21 '21 at 02:13
  • yeah work i was change with Instant Client for Mac OS X (PPC) version. but when try code with `oci_connect()` my page comback to 502 bad gateway against , try with `php -q b.php` like as explain on above i get error `_OCIEnvNlsCreate` – Yogi Arif Widodo Jun 21 '21 at 02:58
  • Are you comparing command line with web usage - please be clear what works and what doesn't? Have you tried the Instant Client maOS Intel with Rosetta? Does the Instant Client ARM package work? – Christopher Jones Jun 21 '21 at 05:12
  • what works - i can run some command line where need oci8 require. for example `composer` - `oci_error()` return false. what doesn't - i can't run some code `.php` with `oci_connect()` where i have enable oci8 extension. i have tried test Instant Client with run sqlplus under rosetta get error `bad CPU type in executable:` without that , i can remote my oracle server. thats mean my instant client its work ? sorry i am new on oracle. – Yogi Arif Widodo Jun 21 '21 at 06:26
  • Other people have been able to use the macOS Intel Instant Client SQL*Plus with Rosetta. I don't have access to M1 to comment further. – Christopher Jones Jun 21 '21 at 22:41
  • thanks in advance sir, i hope i can solve this problem, for while i use docker for work on oracle. what i research of part version oracle instant ,package instantclient-basic-macosx-10.1.0.3 is work on `php -i` but the version not compatible on m1 for `php function`, then > 10 version (v11, v12.1, v12.2, v19.8) is not work on `php -i ` (that's mean i can't run `phpinfo()` for seeing oci8 is enabled) but the version is compatible on m1. – Yogi Arif Widodo Jun 21 '21 at 23:58

0 Answers0