log4php failed connecting to mysql-cluster database in ubuntu12.04 - php

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.

Related

PHP oci_connect() is working on terminal/Centos server but not on browser

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

Why am I getting so many error messages in phpmyadmin localhost?

I just set up XAMPP and, when I start the Apache localhost, it displays all of these errors when I search "localhost/phpmyadmin"
I am very new to this (just downloaded XAMPP) and I watched this tutorial: https://www.youtube.com/watch?v=hqfIksHKPPg on setting it up (I didn't install phpmyadmin since it was already installed with XAMPP)
I edited the notepad text files as stated in the video, but instead of a login, I get all of the error messages shown in the above picture...
I also opened config.inc.php and edited the line:
['Servers'][$i]['(MySQL root password)'] = '';$cfg
so it matched MySQL root password
Even if you have a suggestion to fix one of the errors, please still comment
Also, if you need any more information please let me know
You're getting several error messages because you have several problems :)
Cannot connect: invalid settings
Some setting is incorrect, most likely something in your config.inc.php is misspelled or incorrectly copied and pasted. Specifically, if the line ['Servers'][$i]['(MySQL root password)'] = '';$cfg is actually how it appears in your configuration, that is clearly the problem as the line should actually be $cfg['Servers'][$i]['password'] = 'green'; except with you password instead of 'green'...except that only applies if your auth_type is 'config', otherwise the 'password' line isn't used at all (since you're prompted for the password at log in). I'm not sure what XAMPP does here for auth_type, but I don't think you should have had to edit the configuration file at all, since you used the XAMPP installer which should have configured everything.
The server requested authentication method unknown to the client [sha256_password]
This appears to be a bit of a version mismatch in your installed files. Access denied after setting user's password with SHA256 in phpMyAdmin goes in to more detail, but this most often occurs when you've got MySQL 8 and PHP older than 7.4. Normally, I'd suggest upgrading your PHP version — but you're using the packaged XAMPP, which certainly wouldn't ship with conflicting MySQL and PHP versions, so something is odd here. Please confirm for us your MySQL and PHP versions. You didn't happen to have an existing MySQL or PHP installation before you installed XAMPP, did you?
Connection for controluser as defined in your configuration failed
This is probably related to the MySQL 8/PHP 7.4 conflict. There is an administrative user (called the controluser) that phpMyAdmin can use to manage some extra features, ordinarily you wouldn't need it to access phpMyAdmin (only to access those additional features), but it seems XAMPP has configured this for you. Since the authentication fails, you get an additional message that the controluser was not able to connect.
You could bypass this by commenting out the configuration lines referencing controluser and controlpass, although again the XAMPP package should have this all configured so I don't recommend that at this point.
The other messages are basically echoes of the previous messages; you get an additional protocol notification because the controluser is trying the same sha256 connection type that the main user was, and then finally phpMyAdmin is telling you that MySQL rejected the connection.
If this is a fresh XAMPP install, I'd suggest reinstalling, because something got a bit confused. I'd also suggest making sure that you don't have any other conflicting software running — XAMPP is a package of all the included parts, so you don't want to install or run your own Apache or MySQL instance which would interfere with the packaged kit.

After snapshot boot : Informix Client -23101 / Oracle instant client -28759

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?

Call to undefined function mysql_connect() on Heroku. (PHP works fine locally but not on heroku- why?)

Thanks for your help in advance. I have been working on this bug for more than 12 hours now.
There is an AJAX signup form in my Heroku site which runs on MySQL and is connected to ClearDB Database. I can successfully send data to the database on my local server (MAMP). However, I cannot do the same on the server.
The requests cannot get send to the database and gets stuck at loading. Upon inspection I realise it is a PHP 500 Error.
I found the key problem in the Heroku logs. 2014-11-24T15:02:31.238493+00:00 app[web.1]: [24-Nov-2014 15:02:30 UTC] PHP Fatal error: Call to undefined function mysql_connect() in /app/index.php on line 5
Line 5 of the index.php is mysql_connect('hostname', 'username, 'password');
I have tried running php_getinfo(); and found that there is no MySQL support in the server. On a side note, I have MySQL support in my localhost.
The server php.ini paths are as such: Configuration File (php.ini) Path /app/.heroku/php/etc/php & Loaded Configuration File /app/vendor/heroku/heroku-buildpack-php/conf/php/php.ini
What should I do?
mysql_* functions are deprecated and actually removed in the next PHP version. Check out mysqli.
Worth noting that you can enable mysql_* on Heroku via composer.json. This is documented in Heroku's devcenter docs on PHP support.
Also recommend you consider using a more modern MySQL library, though :)

phpGrid "Error: Could not connect to the database" debugging

I have implemented a phpGrid that works in my dev environment but just keeps saying:
Error: Could not connect to the database
in production
I am logging failed attempts at MySQL connections in the logs on and if I put in a dodgy username and password in the conf.php files username/password it does not show up in the log (I've tested the log is working by attempting to connect with bad credentials via a terminal.
The host is just "localhost" I am using PDO connections elsewhere within my code and the are all connecting using "localhost" so I see now reason why this would be a problem.
In the conf.php I've turned on:
define('DEBUG', true);
And on my grid I have:
$dg -> enable_debug(true);
But I just keep getting this stupid error that tells me nothing about what's really going on...
It happened to me as well. Finally I was able to figure out. The reason is mySQLi was not enabled on the server. I enabled it and it works now.
Sorry, i cannot add a commant and sorry for my english.
If you are using PHP 5.5 try:
error_reporting=E_ALL^E_DEPRECATED
at top of the page for the time being.
For the files on your production machine: proof if they are still in utf-8 encoding

Categories