Not to waste your time, I'll describe what I had && what I have now. My apps are written on php. They live on redhat6 server with nginx + apache web servers. We store data in MySQL DB, but we have lots of imports from Oracle and IBM Informix DB's, & mssql. For Oracle & Informix I have installed clients && compiled libraries pdo_oci.so & pdo_informix.so . For a few months they were working as expected.
But a week ago, admins made a snapshot of out virtual server, and reloaded it. Now only MySQL and mssql connectors work, and Oracle & IBM clients thows errors.
Oracle : -28759
Failed : SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-28759: failure to open file (/usr/local/src/php-5.3.3/ext/pdo_oci/oci_driver.c:579)/opt/project/www/test.php149
IBM Informix : -23101
Failed : SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101./opt/project/www/test.php146
Well, as official documentations says, Informix error is connected with the lost env variables of DB_LOACALE & CLIENT_LOCALE...etc.
This is strange, because all this time I was using this string for my connections :
$dbh = new PDO ("informix:host=example.ru; database=some_db; server=db_net; CursorBehavior=0; DB_LOCALE=en_US.57372; CLIENT_LOCALE=en_US.57372;", "db_login", "pass");
I tried to set up this env variables for apache (httpd) , but this error still accures. Now I have this variables set after server reboot, but no success. May be I'am doing something wrong or at the wrong place or user name...
About Oracle , documentation says that it is connected with files loading:
And the web doc says that it is mostly ssl error and is connected with the trouble of the client, that can not find SSL Wallet files. I Have TCPS secure connection to Oracle DB with wallet, and I remember that it was a real trouble to make Instant client to look at the right place. More than that, I have client tracing enabled, but it is writing log only when I use sqlplus directly from terminal. When I run my php scripts, I got only errors and no log.
Questions:
How to enable Informix variables correctly, or how to resolve this
issue in different way.
How to enable "net tracing" for oracle, to
see what he is looking for?
How to store this variables for future
reboots/reloads/snapshots...etc. ?
People. Enable tracing of all what is possible and use "strace" command to check where programm is failing!!!
Thanks to Luís Marques! I found gls in my logs and tried to make link for it.. to real IBM/informix/gls... than another msg trouble acured.../ I made soft link from /usr/informix to my real /opt/IBM/informix and all connections successfully woke up!
Thank you man. You really helped me to finish this trouble. I post this as ansver but will accept yours as thanks to you! =)
This may be related to file / dir permissions rather than env variables.
The oracle error seems to indicated that it can no longer open/read the files it requires.
The informix -23101 error can also be caused by the driver being unable to read GLS files required for locale support.
Does the apache user have access to the Informix Client SDK directories and files?
Related
I am getting error when I trying from browser.
Warning: oci_connect(): ORA-28759: failure to open file in
/var/www/myapp/abc.php on line 16
Fatal error: ORA-28759: failure to open file in /var/www/myapp/abc.php on
line 19
But when running same file from Server terminal as a root user > PHP abc.php that time oracle database output is coming.
I didn't understand why is running from terminal but not on browser.
I am using PHP7, Apache and Installed Oracle 19c home db.
I am using oci_connect to communication with oracle database from PHP code.
I think there is some permission issue to my httpd (apahce).
Please give suggestion.
Check that the web server process has access to all the Oracle client libraries and data files. Since you are using an Oracle home, make sure all the directories have 'other' access permissions set. Typically user home directories don't have this by default.
Since the app is running, some libraries are being loaded so maybe permissions are OK? Make sure you have the web server process environment variables the same as those used by your command shell to make sure the same set of Oracle client libraries are being used. (Do you also have Instant Client installed somewhere, or another Oracle home??).
The recent common causes of 'ORA-28759: failure to open file' are when Oracle cloud wallets are being used and the sqlnet.ora path to the wallet (the DIRECTORY=... bit) is not valid. Check the path is OK, or the Oracle Net configuration files are in the default location (and are readable). Note that with Instant Client 19.14 you can use 1-way TLS so wallets are not always needed, depending on your net configuration.
I doubt there is a problem with php.ini, since you are obviously able to call OCI8 functions. The php.ini file doesn't control behaviors of the Oracle Client libraries that are throwing the error.
Update your question with more details about how you are setting the environment and what Oracle configuration files are being used for connecting
it's about more than one full day that i started sqlanywhere and i'm so interested to use it,
i worked before with sqlsrv for ms sql server and connection via php ,
but i have problem for connecting php to sqlanywhere
here is the warning message when i try to run test.php
Installation successful Using php-5.6.0_sqlanywhere.dll
Warning: sasql_connect(): SQLAnywhere: [-100] Database server not found in C:\xampp\htdocs\test.php on line 44
Connection failed
$conn = sasql_connect( "UID=DBA;PWD=sql" );
if( $conn ) {
echo "Connected successfully\n";
sasql_disconnect( $conn );
} else {
echo "Connection failed\n";
}
I'm using xampp server php 5.6 and sqlanywhere 17 developer edition.
already i downloaded the php extension and copied on ext and also added the line in php.ini (extension=php-5.6.0_sqlanywhere.dll)
demo database i ran it with cmd : dbeng17 "%SQLANYSAMP17%\demo.db".
via cmd i tried this also :
C:>dbping -d -c "uid=dba;
SQL Anywhere Server Ping U
Connected to SQL Anywhere
Ping database successful.
but when i try via php it says: Warning: sasql_connect(): SQLAnywhere: [-100] Database server not found in C:\xampp\htdocs\test.php on line 44
Connection failed
please someone tell me what is the problem ?
thank you very much.
Your PHP installation may have multiple files similar to php.ini. Make sure you are modifying the php.ini file listed in phpinfo().
- A web server such as Apache, IIS, or any web server that supports
PHP.
- PHP installed on the same computer as the web server.
- SQL Anywhere installed on the same computer as the web server.
- The client software can be used as well. SQL Anywhere PHP extension
Refrance : https://wiki.scn.sap.com/wiki/display/SQLANY/Getting+Started+with+SAP+SQL+Anywhere+and+PHP
It solved for me when I installed and used it on another system , I don't know I tried first on a system that MSSQL server was install and I couldn't run it and tried on another system that mssql server was not installed and solved :)
sorry for being late to answer and thank you very much for those who took time to help me.
all,
My log4php gets this error in a new server environment.
PHP Warning: log4php: [LoggerAppenderPDO:default]: Failed connecting to database. Closing appender. Error: could not find driver in ../log4php/LoggerAppender.php on line 283
I have the same settings for log4php (1. config.xml file 2.same log4php version) as my local development, which works perfectly. I tried simply log to a file in the new server, it works, which means the log4php lib has no problem. And I can even log to the database in the new server from my local script using local log4php lib, which means my server can recognize log4php logging.
I think this should related to the authentication to the database from the server itself. But have no idea what is the problem and how to solve it. Any idea?
Work around:
After some searches and tests(script using PDO not mysqli to connect to the database,reference here) , I confirm the problem is caused by lacking of pdo_mysql related driver, as akluth pointed out. I tried to re-install php5-mysql, but it failed, I tried to modify php.ini, got more errors. I think that is because the mysql-cluster settings maybe different from normal mysql. As the new server is a production server, we decide not to touch it and move the scripts to other server with normal mysql settings.
I have the issue, to get a PHP script connecting to an Informix DB. I thought installing the Zend-server community edition and in addition the pdo_informix extension. When I run the Zend-server admin in the browser, I see the pdo_informix extension marked as "green". Afterwards I've installed the Informix ClientSDK 3.70 on Ubuntu. I've set the $INFORMIXDIR environment variable into /etc/profile and into the PATH variable to the bin directory. The installation dir was /opt/IBM/informix . When I now try to write code in PHP like
try{
$db = new PDO("informix:host=xx.xx.com;database=xxx;server=xxx_net; protocol=onsoctcp;", databaseuser, databasepassword);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "test";
}catch (PDOException $e){
echo "<br/>Failed: ". $e->getMessage()."<br/>";
}
I've got the following error in the browser:
Failed: SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix]
[Informix ODBC Driver][Informix]Unspecified System Error = -23101.
If I'm trying to connect with the Server Studio on Ubuntu to the Informix DB it works well, but I guess they are using the JDBC driver.
If I go to the bin directory of my Informix clientsdk, there is an application called finderr. If I do a finderr -23101 I get the following output:
./finderr -23101
-23101 Unable to load locale categories.
So i thought that I have to set the DB_LOCALE, CLIENT_LOCALE environment variables... my server is using en_us.819 and my client is using en_us.utf8 .
Being unable to load locale categories normally means that either INFORMIXDIR is not set for the software trying to access the Informix locale data (which is found in $INFORMIXDIR/gls), or that the locale categories are unspecified or mis-specified. These are classically the environment variables CLIENT_LOCALE and DB_LOCALE, which have values such as 'en_us.8859-1' (the default) or 'es_es.utf8' (Spanish in Spain using UTF-8).
I would concentrate on ensuring that the browser has the environment set correctly. It may depend on how you launch it.
There are some other environment variables that could be used - DBLANG, LANG, and the LC_* set of names. However, they are unlikely to be needed if CLIENT_LOCALE and DB_LOCALE are set. With that said, I've recently found that with Informix 4GL (I4GL), some code written with Japanese characters in things like table names would not compile unless DBLANG was set as well as the *LOCALE variables. However, the LC* and LANG variables seemed to have minimal to no effect on the result.
You probably have to set LD_LIBRARY_PATH. I do it with:
export LD_LIBRARY_PATH=$INFORMIXDIR/lib/:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:
export PATH=$INFORMIXDIR/bin:$INFORMIXDIR/lib:/usr/local/bin:/usr/bin:/bin
If that will not help then you can try with unixODBC. It seems that PHP uses some kind of ODBC. In unixODBC online manuals there is article about connecting to Informix - read it. Use isql (interactive SQL) unixODBC tool to connect to configured ODBC database.
If isql cannot connect to database with the same error then you can use strace to see what library the ODBC driver cannot load.
I'm venturing out of the world of .NET and into the world of open-source. However, I've hit a few roadblocks while trying to get my development environment set up. And I'm kind of stuck on the most recent one.
I have installed: Apache 2.2, php 5.3.2, and mySQL 5.1.48
everything is working pretty much; apache is serving up PHP pages, and I'm able to create databases and tables in mySQL, however, I can't seem to get php to communicate correctly with mySQL. My php.ini has these lines un-commented:
extension=php_mysql.dll
extension=php_mysqli.dll
However, I keep getting this error message:
Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysql_test.php on line 15
any help would be greatly appreciated.
(btw, the php code runs properly when I put it on my web host)
This is most likely a configuration problem with the MySql server. It sounds like it either isn't listening on the correct port or something else is going on with the connection. You have the extensions loaded correctly because PHP is able to find the mysql functions. I would make sure you don't have a firewall blocking any of the requisite ports (actually, just try turning off your firewall and see what happens...just don't forget to turn it back on ;-) ). Also make sure if you are following a tutorial you didn't deviate from the MySQL setup instructions at all. If those don't work, post an update and we can try again.
This looks like bug #45150 : MySQL functions cannot be used with 5.3.x on Vista when using "localhost" -- I've had this problem once, and it took me some time to figure out what was causing it...
If you are working with Windows Vista (and possibly seven ?), and trying to connect to MySQL using "localhost" as host, try to replace that by the corresponding IP address : "127.0.0.1"
Or try to edit the hosts file, and to un-comment the line that corresponds to localhost in IPv4 :
127.0.0.1 localhost
(Remove the # at the beginning of the line)
Or to comment the line that corresponds to localhost in IPv6 :
#::1 localhost
(Add a # at the beginning of the line)
And here's an interesting article about that : PHP 5.3 and MySQL connectivity problem
Use XAMPP - it'll remove any headaches like this for local development.
XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.