Edit report at https://bugs.php.net/bug.php?id=61223&edit=1

 ID:                 61223
 Comment by:         mikhail dot v dot gavrilov at gmail dot com
 Reported by:        4yuinfo at gmail dot com
 Summary:            php can run oci,but php-fpm oci error
 Status:             Feedback
 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:

Look here solution http://www.php.net/manual/it/oci8.installation.php#110226


Previous Comments:
------------------------------------------------------------------------
[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?

------------------------------------------------------------------------
[2012-03-01 16:45:46] 4yuinfo at gmail dot com

Description:
------------
update php 5.3.5 to php 5.3.10
php-fpm oci can't run

Test script:
---------------
cat a.php
---------------------------------------------------------
<?php
print oci_connect('login_id', 'login_pw', 'oracle_db');
---------------------------------------------------------
#command line
php -q a.php
Resource id #5
#nginx+php-fpm
502 bad gateway
#apache + perfork
Resource id #3

Expected result:
----------------
oci8 run to php-fpm can work

Actual result:
--------------
oci8 run to php-fpm can't work


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61223&edit=1
  • Bug #61223 [Com]: php can run ... mikhail dot v dot gavrilov at gmail dot com

Reply via email to