i had a server there is apache, php and oracle the configuration is complete from php.ini and path
but when i running script php in browser there always an error.
ci_pconnect(): OCIEnvNlsCreate() failed.
and then when i'm running in terminal it's works..
NB: in apache env is complete
LD_LIBRARY_PATH=/apps/oracle/client/client_1/lib
ORACLE_HOME=/apps/oracle/client/client_1
ORACLE_BASE=/apps/oracle
please help me fix this
You need to set the same environment variables so that Apache can access them, and make sure that the Apache process has directory permissions to read the Oracle libraries.
How you set the environment depends on your OS and version of Apache.
For example, on RHEL 6 or Oracle Linux 6 you would add these to /etc/sysconfig/httpd:
export LD_LIBRARY_PATH=/apps/oracle/client/client_1/lib
export ORACLE_HOME=/apps/oracle/client/client_1
export ORACLE_BASE=/apps/oracle
On RHEL 7 or Oracle Linux 7 you would add these to /etc/sysconfig/httpd:
LD_LIBRARY_PATH=/apps/oracle/client/client_1/lib
ORACLE_HOME=/apps/oracle/client/client_1
ORACLE_BASE=/apps/oracle
There are some other hints on p77 of http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
Related
I have an Ubuntu VM / Azure SQL DB combo where I have two sets of PHP files.
1) Some scripts that run from CRON jobs
2) A Yii2 Framework website
Both environments connect to an SQL Server database.
I have done all the steps to compile sqlsrv and added it to PHP's list of extensions. My scripts work great from the terminal, but on the website, I get an error:
could not find driver
My webserver is nginx, and it runs the website properly, but PDO does not connect to SQL Server.
I only have one PHP installation, but nevertheless used code to determine which is the right php.ini file in use and it has the right extensions directive.
A phpinfo() output also shows sqlsrv in the 'Registered PHP Streams' section.
My UFW firewall is inactive and I don't have SUSELinux. Nevertheless ports 22 and 80 are open. Even tried enabling it.
I am not sure what else to try. Help!
EDIT
I created a simple test file. When I run that through the terminal, it works, but when I do so via a browser, it doesn't.
EDIT 2
I installed Apache2 instead of nginx, and everything works now.
I think you need to try with just some "Hello world". If this not help type in terminal:
sudo apt-get install php-mysql
And restart your nginx server with:
sudo killall nginx && /usr/local/nginx/sbin/nginx
I'm having some difficulty setting up Nginx with PHP and MYSQL on mac, where I cannot make any connection to the database. If I spawn a server using php -S, I can connect without problem. However Nginx running on port 8080 is unable to connect at all.
I've installed (and now uninstalled) php with brew, which might be an issue because it looks like PHP comes installed on mac. Running php -v shows me running on 7.1.16, but the brew installed version was 7.2+. I have PHP-FPM running on localhost:9000.
I've checked my php.ini files, but I only see extensions for mysqli and pdo_mysql, which I've tried to enable but still no luck.
Thanks for any help.
I've been baffled and frustrated that I've been trying to update one of our servers that my supervisor installed and when I run any PHP installed module, it starts with wrong version of PHP. The server always starts with PHP Version 5.4.19. Regardless of what module I installed and checked that the files run with, it always starts with that version according to phpinfo. Server runs MS Server 2008 R2. My objectives are to 1) Update PHP to Version 5.6. and 2) Use ZeroXI controller for modularity of the server.
Here's what I've found and checked so far:
Supervisor installed two types of Uniservers while trying them out: Uniserver Coral don't know which version, but I tried updating to Coral 8.9.2... Initially, I uninstalled the original services but cannot verify (1) What is the name of the service in order to verify that? Also all of the apache and mysql modules are stopped and ZeroXI can peacefully start apache and mysql.
The other uniserver is Uniserver ZeroXI 1.1.6. Oddly enough, there was an installed service that wasn't running so I uninstalled that as well. I can verify that us_apache_1 service is not running. I installed php_5_6_0 which the documentation says that it supports. However, even if php56 is selected and phpinfo verifies that
Loaded Configuration File C:\uniserver\core\php56\php_production.ini
Apache Environment:
PATH C:\uniserver\core\apache2\bin;C:\uniserver\core\mysql\bin;C:\uniserver\core\php56;C:\uniserver\core\openssl;C:\uniserver\core\msmtp;C:\uniserver\utils;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.6\bin
Core:
extension_dir C:/uniserver/core/php56/extensions
Environment:
PHP_SELECT php56
Well, Apparently:
PHP Version 5.4.19
(2) Are there any other causes why the uniserver zeroxi uses 5.4.19 although it is set as php 5.6.0?
I have tried installing a new uniserver zeroxi controller under a different folder name, but to no avail, it consistenly still uses the same php version. Please let me know what other things that could point me to what is causing this.
Thanks in advance.
Just to update what happened and our solution and this may apply to various WAMPP installations as well...
We thought that
Configuration File (php.ini) Path C:\Windows
had nothing to do with our install of Uniserver. Apparently there is this errant php5ts.dll in the Windows folder. This file loaded the wrong version of php. As soon as we copied the dir/to/php/folder/php5ts.dll (c:\uniserver\core\php56\php5ts in our case), all of the modularity of unizerver zeroxi worked again.
For other WAMPP installs, you might want to check the same php.ini path in you phpinfo and if you have C:\Windows as the path, you can backup then copy the php5ts.dll file from the php installation folder to the Windows folder.
I've installed Apache 2.2 and PHP 32bit on a Windows 7 64bit.
I configured properly PHP to run as a module and works like a charm.
Then I've installed MySQL Server 5.1 64bit.
After activating mysql or mysqli, php runs as expected but when I connect to localhost with the browser, the php script cannot connect to the database using mysql_connetc() and it generate a timeout error.
Running phpinfo() it says that the mysql modules are running with no errors.
I've tried to uninistall mysql server win64 and reinstall the same version but for win32.
The same happens.
Googling around I found this post on the mysql forum
http://forums.mysql.com/read.php?11,366955,366962#msg-366962
http://forums.mysql.com/read.php?11,366955,378099#msg-378099
Basically if you do not set in the host file that localhost is 127.0.0.1 windows 7 uses IPV6 address by default for localhost resulting in a connection error.
Adding this to the host file solve the problem:
127.0.0.1 localhost
Have you added appropriate firewall exceptions? can you connect to mysql using the command-line tool or similar?
I have installed XAMPP on a Windows XP Machine. PHP scripts are working fine through the browser.
Initially, PHP.exe (CLI) was failing with error - can't load php_pgsql.dll
I disabled extension=php_pgsql.dll in the php.ini file and PHP.exe stopped to fail.
However, even now I am not able to run a PHP script from the CLI even though the same script runs fine through the browser.
The script fails at mysqli_connect() with error - Can't connect to MySQL server on '127.0.0.1'
Has somebody else faced the same problem?
Kshitij
Did you start the MySQL service via the XAMPP Control panel and it kept beeing marked as "Running" in both test cases?
Did you test the webserver version by requesting something like http://localhost/... or http://127.0.0.1/... and did you run the php.exe -f something.php test on the same machine?
How many php.ini have you got? It's likely the CLI version has a different php.ini than the web version.
Is the path to your mysql DLLs in your command session's PATH environment variable? You probably need to add \pathtomysql\bin to your path. On my machine it is:
C:\Program Files\MySQL\MySQL Server 5.0\bin