Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 551888

Summary: dev-lang/php[fpm oci8] should add env[ORACLE_HOME] line to php-fpm.conf
Product: Gentoo Linux Reporter: Zoltán Halassy <zhalassy>
Component: Current packagesAssignee: PHP Bugs <php-bugs>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Zoltán Halassy 2015-06-12 13:50:20 UTC
When php is running in FPM mode, it will not get the environment variable(s) needed for oci to work, like ORACLE_HOME. php-cgi and php-cli don't have this problem. adding an

env[ORACLE_HOME] = /usr/lib64/oracle/VERSION/client

line to php-fpm.conf solves this problem.


Reproducible: Always

Steps to Reproduce:
Install php[fpm oci]
Try to connect to an oracle database through PDO with ;charset=utf8 parameter, like
<?php new PDO("oci:dbname=//ip:port/db;charset=utf8");
Actual Results:  
OCIEnvNlsCreate: Check the character set is valid and that PHP has access to Oracle libraries and NLS data

Expected Results:  
Connect without problems.
Comment 1 Ole Markus With (RETIRED) gentoo-dev 2015-06-14 07:25:31 UTC
I am not sure about this. How would we ensure VERSION is correct and such?

We could add einfo about setting this in postinst, but generally, I think this is just something end users need to configure.
Comment 2 Zoltán Halassy 2015-06-15 07:45:13 UTC
An einfo should be good enough. But the ebuild also could read the /etc/env.d/50oracle-instantclient-basic file. Like:

ORACLE_HOME=`grep ^ORACLE_HOME= /etc/env.d/50oracle-instantclient-basic | cut -d= -f2`
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2015-06-15 08:39:48 UTC
(In reply to Zoltán Halassy from comment #2)
> An einfo should be good enough. But the ebuild also could read the
> /etc/env.d/50oracle-instantclient-basic file. Like:
> 
> ORACLE_HOME=`grep ^ORACLE_HOME= /etc/env.d/50oracle-instantclient-basic |
> cut -d= -f2`

Then I'd rather just disable clear_env:
http://php.net/manual/en/install.fpm.configuration.php#clear-env
Comment 4 Zoltán Halassy 2015-06-15 09:04:05 UTC
Well, if it's considered secure enough, then the provided default config file could explicitly set clear-env to false. Or if not, then an einfo could warn about it still.
Comment 5 Michael Orlitzky gentoo-dev 2017-01-04 04:18:56 UTC
Try setting,

  env[ORACLE_HOME] = $ORACLE_HOME

That will pull the value of $ORACLE_HOME from the environment, but I'm not sure if $ORACLE_HOME will have the correct value by the time that php-fpm starts. If it does work, I'll add that line to php-fpm.conf in a new revision.
Comment 6 Michael Orlitzky gentoo-dev 2017-02-09 13:18:13 UTC
Ping... we need an Oracle user to test the trick in comment #5. I'm certain that setting "env[ORACLE_HOME] = $ORACLE_HOME" in php-fpm.conf pulls in the value of $ORACLE_HOME from the environment, but I'm not sure at what point during your boot sequence the $ORACLE_HOME environment variable gets set. It would need to be before php-fpm starts.
Comment 7 Michael Orlitzky gentoo-dev 2017-04-07 00:55:05 UTC
I'm going to mark this NEEDINFO for now, but feel free to reopen it if you're able to test the idea in comment #5.