Мне нужна ваша помощь для подключения Oracle к PHP. Используется сервер Red Hat 8.9, версия PHP 8, включен OCI8, установлен веб-сервер HTTPD.
Какие бы шаги мне ни потребовались,
> /etc/httpd/conf/httpd.conf
SetEnv LD_LIBRARY_PATH /home/oracle/Avani/dbhome_1/lib
SetEnv NLS_LANG American_America.UTF8
SetEnv PATH /usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/oracle/Avani/dbhome_1/bin
PassEnv LD_LIBRARY_PATH
/etc/sysconfig/httpd
export LD_LIBRARY_PATH=/home/oracle/Avani/dbhome_1/lib
export ORACLE_HOME=/home/oracle/Avani/dbhome_1
export ORACLE_BASE=/home/oracle
export PATH=/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/oracle/Avani/dbhome_1/bin
~/.bashrc
# .bashrc
# User specific aliases and functions
export LD_LIBRARY_PATH=/home/oracle/Avani/dbhome_1/lib
export NLS_LANG=American_America.UTF8
export TNS_ADMIN=/home/oracle/Avani/dbhome_1/network/admin
export PATH=$PATH:$ORACLE_HOME/bin:$LD_LIBRARY_PATH:.
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export LD_LIBRARY_PATH=/home/oracle/Avani/dbhome_1/lib
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH:$ORACLE_HOME/bin
~/.bash_profile
#.bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_HOME=/home/oracle/Avani/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=/home/oracle/Avani/dbhome_1/lib
export NLS_LANG=American_America.UTF8
export TNS_ADMIN=/home/oracle/Avani/dbhome_1/network/admin
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH:$ORACLE_HOME/bin:$PATH:.
# User specific environment and startup programs
export PATH
OCI8 включен
Ошибка
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /var/www/html/db2.php on line 10
Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804 in /var/www/html/db2.php on line 10
Warning: Trying to access array offset on false in /var/www/html/db2.php on line 14
Connection failed:
Код
/etc/systemd/system/httpd.service.d/httpd.conf
[Service]
Environment="LD_LIBRARY_PATH=/home/oracle/Avani/dbhome_1/lib"
Environment="PATH=/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/oracle/Avani/dbhome_1/bin"
Подробнее здесь: https://stackoverflow.com/questions/790 ... with-httpd