Home >Backend Development >PHP Problem >How to solve the Chinese garbled problem of php pdo oci
php pdo oci Chinese garbled solution: first set the environment variable in php-fpm; then add the content "env[ORACLE_HOME] =/usr/lib/oracle/11.2/client64/..."; Finally, restart php-fpm.
The operating environment of this article: Windows 7 system, php5.4.19 version, DELL G3 computer
php uses PDO_OCI to connect to oracle, garbled code under php-fpm , the solution to the normal command line
win7+nginx1.5.9+php5.4.15+pdo_oci
After completion, the result is normal.
Upload test.
centos5.9+nginx1.5.9+php5.4.14+pdo_oci
Result: The command line is normal, and the fast_cgi mode is normal
So upgrade the php version to the latest php5.4.33 and reinstall
Result: The command line is normal and not garbled, the fast_cgi connection is normal, but the garbled characters.
Cannot be found on various Google and Baidu Solution.
Install another php version php5.4.19 that is consistent with the official environment
Result: fast_cgi connection is still normal, but garbled.
There must be a problem with the environment variables .
Finally, I found an article saying that environment variables can be set in php-fpm, so give it a try. Add a few lines at the end:
env[ORACLE_HOME] =/usr/lib/oracle/11.2/client64/ env[LD_LIBRARY_PATH] =/usr/lib/oracle/11.2/client64/lib/ env[NLS_LANG] ="AMERICAN_AMERICA.AL32UTF8"
Restart php-fpm
Result: Everything is normal.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to solve the Chinese garbled problem of php pdo oci. For more information, please follow other related articles on the PHP Chinese website!