Edit report at https://bugs.php.net/bug.php?id=61223&edit=1
ID: 61223 Comment by: haris dot srafiq at gmail dot com Reported by: 4yuinfo at gmail dot com Summary: php can run oci,but php-fpm oci error Status: Closed Type: Bug Package: OCI8 related Operating System: CentOS 6.2 PHP Version: 5.3.10 Assigned To: sixd Block user comment: N Private report: N New Comment: OS : Centos 5.7 final x86_64 INSTANT CLIENT :11.2.0.3-1 x86_64 PHP : 5.3.14 Webserver : nginx 1.2.4 and apache 2.2.23 configure --enable-fpm --with- oci8=shared,instantclient,/usr/lib/or acle/11.2/client64/lib --with-pdo- oci=instantclient,/usr,11.2 -- prefix=/usr/local/php5 edit php.ini add extension=oci8.so Reload php-fpm Service solved my problem sorry my bad english Previous Comments: ------------------------------------------------------------------------ [2012-10-15 07:55:41] 4yuinfo at gmail dot com discovery of errors raised --------------------------------------------------------------- database use [ Dedicated server ] so client tnsname.ora setting use (SERVER=DEDICATED) php-fpm + nginx have 502 bad --------------------------------------------------------------- chang client tnsname.ora setting (SERVER=SHARED) php-fpm + nginx is working --------------------------------------------------------------- ------------------------------------------------------------------------ [2012-10-12 21:46:25] mikhail dot v dot gavrilov at gmail dot com Look here solution http://www.php.net/manual/it/oci8.installation.php#110226 ------------------------------------------------------------------------ [2012-03-05 20:28:51] s...@php.net Try real error checking with oci_error(). Write the output to a log. Check all logs to see if there are startup errors, such as libraries not found. A side comment: since you are using Oracle Instant Client you should not set ORACLE_HOME. If you need access to a tnsnames.ora file, set TNS_ADMIN instead of ORACLE_HOME. Can you strace the webserver process and see what calls are being made? Try building PHP from source and linking oci8 as a static extension not "shared". ------------------------------------------------------------------------ [2012-03-03 02:32:58] 4yuinfo at gmail dot com cat b.php #------------------------------------------------------------------- <?php if (@oci_connect('login_id', 'login_pw', 'oracle_db')) { print 'right'; } else { print 'error'; } #------------------------------------------------------------------- #command line php -q b.php right #apache curl http://127.0.0.1:80/b.php right #ngixn + php-fpm curl http://127.0.0.1:81/b.php 502 bad gateway => but remove remi 5.3.10 rpm => reinstall remi 5.3.5 rpm show right string is work #------------------------------------------------------------------- #1.download CentOS-6.2-x86_64-minimal.iso #2.install CentOS-6.2-x86_64-minimal.iso #3.yum add repo remi and nginx yum install php-* --skip-broken php-mysql #no install php-pecl* and php-pear* yum install nginx #4.set nginx and php-fpm #5.download oracle client oracle-instantclient-11.2.0.1.0*.rpm #6.rpm -ivh oracle-instantclient-11.2.0.1.0*.rpm #7.set oracle environment variables in the bashrc and php-fpm #======================================================================== #-------------------------- # php-fpm.conf #-------------------------- [global] pid = /var/run/php-fpm/php-fpm.pid emergency_restart_threshold = 1 emergency_restart_interval = 20m process_control_timeout = 15m [test] listen = 127.0.0.1:5101 listen.allowed_clients = 127.0.0.1 user = nginx group = nginx pm = static pm.max_children = 20 pm.max_requests = 0 pm.status_path = /php-fpm/status ping.path = /php-fpm/ping ping.response = pong request_terminate_timeout = 10m request_slowlog_timeout = 0 rlimit_files = 65530 rlimit_core = 0 env[HOSTNAME] = $HOSTNAME env[ORACLE_HOME] = /usr/lib/oracle/11.2/client64/ env[LD_LIBRARY_PATH] = /usr/lib/oracle/11.2/client64/lib/ env[NLS_LANG] = "TRADITIONAL CHINESE_TAIWAN.UTF8" env[TNS_ADMIN] = /etc/oracle php_admin_flag[short_open_tag] = on php_admin_flag[display_errors] = on #======================================================================== # command line add oracle client environment variables #======================================================================== echo -e "export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/\nexport NLS_LANG=\"TRADITIONAL CHINESE_TAIWAN.UTF8\"\nexport TNS_ADMIN=/etc/oracle" >> /etc/sysconfig/httpd echo -e "export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/\nexport NLS_LANG=\"TRADITIONAL CHINESE_TAIWAN.UTF8\"\nexport TNS_ADMIN=/etc/oracle" >> /etc/bashrc echo -e "export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/\nexport NLS_LANG=\"TRADITIONAL CHINESE_TAIWAN.UTF8\"\nexport TNS_ADMIN=/etc/oracle" >> /etc/profile #======================================================================== ------------------------------------------------------------------------ [2012-03-02 19:32:15] s...@php.net Do non-Oracle apps work? The 502 isn't obviously going to be caused by an Oracle problem. Add error checking on the the oci_connect call and see what message is being passed. What configuration options did you use? What Oracle client did you use? What Oracle environment variables have you set? How/where did you set the variables? What is your fpm configuration? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=61223 -- Edit this bug report at https://bugs.php.net/bug.php?id=61223&edit=1