Trouble connecting to MySQL Zend Framework - mysql

I'm trying to set up an application using the Zend Framework but the problem i'm getting is as soon as i add the following line in the application.ini the default home page that is created by the zend tool throws a fatal error
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message 'Configuration array must have a key for 'password' for login
credentials' in C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php:295
Stack trace: #0 C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php(183):
Zend_Db_Adapter_Abstract->_checkRequiredOptions(Array) #1
C:\xampp\php\PEAR\Zend\Db.php(270):
Zend_Db_Adapter_Abstract->__construct(Array) #2
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(142):
Zend_Db::factory('PDO_MYSQL', Array) #3
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(154):
Zend_Application_Resource_Db->getDbAdapter() #4
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(683):
Zend_Application_Resource_Db->init() #5
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('db')
6 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #7
C:\xampp\php\PEAR\Zend\Ap in
C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php on line 295
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.dbname = codenamesnm
i'm using xampp with windows 7 Any idea what is wrong

Do not omit these lines:
resources.db.params.username = rob
resources.db.params.password = 123456
set them to "root" or "" if necessary, but let them into your application.ini.

Related

Fatal mySQL error while trying to access DVWA

I am trying to setup DVWA and I did all the steps according to this video (https://www.youtube.com/watch?v=cak2lQvBRAo) till renaming the config file to config.nic.php and changing the password field to blank.
Something like this-
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = '';
$_DVWA[ 'db_port'] = '3306';
I get the error on this page (http://127.0.0.1/login.php)-
Fatal error: Uncaught mysqli_sql_exception: Unknown database 'dvwa' in C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php:499
Stack trace:
#0 C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php(499): mysqli_query(Object(mysqli), 'USE dvwa')
#1 C:\xampp\htdocs\login.php(8): dvwaDatabaseConnect()
#2 {main}
thrown in C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php on line 499
Can't even access the DVWA setup. I am using XAMPP and the Apache2 (ports 80, 443) and mySQL (port 3306) are running fine. Please help!
Got the answer for you.
Try localhost/dvwa/setup.php on browser
Then click on create or reset database and it should get to login page
Remember user name and password must be same as what you configured in config.php
Good luck

Flutter mysql1 got packets out of order

I have some troubles in setting up a connection with my VPS with the library mysql1 on flutter. I get this error Unhandled Exception: Error 1156 (08S01): Got packets out of order when I perform a query.
MySQL server version: 8.0.28
This is my service in which I perform the connection with my database.
var settings = ConnectionSettings(
host: 'MY_ADDRESS',
port: 3306,
user: 'root',
password: 'MY_PASSWORD',
db: 'MY_DATABASE'
);
Future connect() async {
return await MySqlConnection.connect(settings);
}
And then I try to retrieve users information in another method in this way:
var connection = await mysqlService.connect();
var res = await connection.query('select name from users');
await connection.close();
The problem is in the connection.query function which generate the error:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Error 1156 (08S01): Got packets out of order
#0 Handler.checkResponse
package:mysql1/…/handlers/handler.dart:77
#1 QueryStreamHandler.processResponse
package:mysql1/…/query/query_stream_handler.dart:50
#2 ReqRespConnection._handleData
package:mysql1/src/single_connection.dart:349
#3 ReqRespConnection._handleHeader
package:mysql1/src/single_connection.dart:318
<asynchronous suspension>
#4 ReqRespConnection._readPacket
package:mysql1/src/single_connection.dart:303
<asynchronous suspension>
I Am not sure if it is a problem with the database that I have on my VPS or is something else.
This package appears to have problems with MySQL 8.
Try to use mysql_client, this one helped me.
https://pub.dev/packages/mysql_client

MySql Connect Lost in Crystal Language with Kemal

I try connection Kemal Framework with crystal-mysql.
This my shard:
mysql:
github: crystal-lang/crystal-mysql
db:
github: crystal-lang/crystal-db
And this my connection:
db = DB.open "mysql://root:password#localhost:787878/book"
But, if I'm running crystal src/book.cr I have this error:
Unhandled exception: (DB::ConnectionLost)
from lib/mysql/src/mysql/read_packet.cr:16:7 in 'initialize'
from lib/mysql/src/mysql/read_packet.cr:6:3 in 'new'
from lib/mysql/src/mysql/connection.cr:77:5 in 'build_read_packet'
from lib/mysql/src/mysql/connection.cr:59:5 in 'read_packet'
from lib/mysql/src/mysql/connection.cr:22:19 in 'initialize'
from lib/mysql/src/mysql/connection.cr:4:3 in 'new'
from lib/mysql/src/mysql/driver.cr:3:5 in 'build_connection'
from lib/db/src/db/database.cr:51:9 in '->'
from lib/db/src/db/pool.cr:255:3 in 'build_resource'
from lib/db/src/db/pool.cr:17:34 in 'initialize'
from lib/db/src/db/pool.cr:15:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
from lib/db/src/db/database.cr:50:7 in 'initialize'
from lib/db/src/db/database.cr:43:5 in 'new'
from lib/db/src/db.cr:139:5 in 'build_database'
from lib/db/src/db.cr:135:5 in 'build_database'
from lib/db/src/db.cr:103:5 in 'open'
from src/news_monitoring.cr:13:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
from __libc_start_main
from _start
from ???
How I can fix it.

MediaWiki MWException - Global default '' is invalid for field stubthreshold

When I click on the Preferences link in our local MediaWiki (1.26.3), hosted on CentOS, I receive the following error:
Internal error
[fbd0dcc9] /index.php/Special:Preferences MWException from line 149 of /var/www/mediawiki-1.26.3/includes/Preferences.php: Global default '' is invalid for field stubthreshold
Backtrace:
#0 /var/www/mediawiki-1.26.3/includes/Preferences.php(101): Preferences::loadPreferenceValues(User, RequestContext, array)
#1 /var/www/mediawiki-1.26.3/includes/Preferences.php(1264): Preferences::getPreferences(User, RequestContext)
#2 /var/www/mediawiki-1.26.3/includes/specials/SpecialPreferences.php(67): Preferences::getFormObject(User, RequestContext)
#3 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPage.php(384): SpecialPreferences->execute(NULL)
#4 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#5 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)
#6 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(714): MediaWiki->performRequest()
#7 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(508): MediaWiki->main()
#8 /var/www/mediawiki-1.26.3/index.php(41): MediaWiki->run()
#9 {main}
Any assistance to resolve the issue is appreciated.
This error can appear for a number of reasons, but the most common is probably an invalid or missing value in $wgDefaultUserOptions in LocalSettings.php.
Default user settings can be changed like this:
$wgDefaultUserOptions['editsection'] = 0;
However, if you add something like this:
$wgDefaultUserOptions = array( 'editsection' => 0, 'watchdefault' => 1, 'watchmoves' => 1, ... );
while everything might seem to work just fine, as you have now overwritten the whole default array, you risk running into an error the next time a new user setting is added in the software, on a MediaWiki upgrade.
The error can also occur because of an extension that uses the UserGetDefaultOptions hook to modify default settings, or because one of the values given in $wgDefaultUserOptions is simply invalid.

'PDOException' with message 'SQLSTATE[HY000] [2002] zend framework

Any one plz tell me why i am getting this error ?? firstly my internet connection was good today its not good so i am getting this error.how can i fix this any idea plz??
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[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 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php:129
Stack trace: #0 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php(129):
PDO->__construct('mysql:host=192....', 'root', 'root', Array) #1 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Mysql.php(109):
Zend_Db_Adapter_Pdo_Abstract->_connect() #2 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(860):
Zend_Db_Adapter_Pdo_Mysql->_connect() #3 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(930):
Zend_Db_Adapter_Abstract->quote('testing', NULL) #4 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Auth\Adapter\DbTable.php(449): Zen
in D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php on line
144
this is my config.ini
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
some code from my index.php
$config = new Zend_Config_Ini(ROOT_DIR.'/application/config.ini', 'general');
$DB = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($DB);
it seems that your code this portion is not working
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
either the IP is not correct if so go to cmd in windows and type ipconfig you will get your correct ip paste it here OR just simply write
db.params.host = localhost
if and only if you are using locally may be it works.
for the hostname/host try to use your credentials found in the Zend Server -> PHP Cloud tab -> Overview page -> User Parameters tab... then make the "host" part in the credentials like this:
[general]
db.adapter = PDO_MYSQL
db.params.host = CONTAINERNAME-db.my.phpcloud.com
db.params.username = ZEND_DB_USERNAME
db.params.password = ZEND_DB_USERNAME
db.params.dbname = ZEND_DB_DBNAME
Did you check your mysql database is up?
If you are sure it is, check that your adapters configuration is ok, maybe the host parameter is not properly configured.