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.
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.
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`
(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
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.
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.
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.
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.