http://go.wlg.co.nz/login.php
I had a page working fine and I swear I didn't change anything. Now its returning this:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in
/home/content/93/10501493/html/go/connect.php on line 15
Warning: mysql_select_db() expects parameter 2 to be resource, boolean
given in /home/content/93/10501493/html/go/connect.php on line 16
Warning: mysql_real_escape_string() expects parameter 2 to be
resource, boolean given in /home/content/93/10501493/html/go/login.php
on line 16
Warning: mysql_real_escape_string() expects parameter 2 to be
resource, boolean given in /home/content/93/10501493/html/go/login.php
on line 17
Warning: mysql_close() expects parameter 1 to be resource, boolean
given in /home/content/93/10501493/html/go/connect.php on line 18
Anything obvious jumps out?
Make sure mysql service is running
service mysqld start
Or
Are you connecting to "localhost" or "127.0.0.1" ? when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could
try using "127.0.0.1" if the socket connector is not enabled/working.
Related
$connection1 = mysql_connect($servername,$username,$password);
$db1 = mysql_select_db($dbname,$connection1);
some html and php code here
$connection2 = mysql_connect($servername1,$username1,$password1);
$db2 = mysql_select_db($dbname1,$connection2);
Error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user '*****'#'***.com' (using password: YES) in /home/
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/
Warning: mysql_query() [function.mysql-query]: Access denied for user '******'#'********' (using password: NO) in /home/
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/
I get this error when i want to fetch something or try to connect
You have to add IP address from your hosting cpanel at option Remove MySQL to allow remote access.
I am trying to install php code sniffer. I have manage to get to a point where after running
php /Users/ryanfernandes/pear/bin/phpcs --version it display the info. but when I try to run code sniffer by
php /Users/username/pear/bin/phpcs /Users/username/development/htdocs/test.php
PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 155
Warning: fwrite() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 155
PHP Warning: stream_get_meta_data() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 206
Warning: stream_get_meta_data() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 206
PHP Warning: file_get_contents(): Filename cannot be empty in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 208
Warning: file_get_contents(): Filename cannot be empty in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 208
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 209
Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 209
Any help would be really appreciated.
Thanks
From the error messages, it looks like you are using PHP_CodeSniffer version 1.5.4. PHP_CodeSniffer uses the tmpfile() function to create a temporary file. The directory that it is created in can be found by running:
php -r 'echo sys_get_temp_dir().PHP_EOL;'
Make sure you are allowed to write to that directory because the tmpfile() method is obviously returning FALSE, which most commonly happens if the directory is not writable.
I've installed unixodbc, freetds, php on Ubuntu 12.04.4 LTS (GNU/Linux 3.8.0-44-generic i686) and I get my query works fine with:
php /var/www/connect.php
but when access to localhost/connect.php I get:
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/connect.php on line 8 Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /var/www/connect.php on line 10 Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in /var/www/connect.php on line 11 Warning: odbc_close() expects parameter 1 to be resource, boolean given in /var/www/connect.php on line 15
I think is about permissions.
I am currently trying to bake models for a project in CakePHP. I have set up my database tables and baked my skeleton project. I then execute the following via terminal:
cake bake -app /home/gary/glecto/
Which then display's me the correct menu. When I choose "M" I get the following error
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 540
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 540
PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 546
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 546
PHP Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 554
Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 554
PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 588
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 588
Your database does not have any tables.
Does anyone have any ideas on how I could solve this? I've been scratching my head for hours.
EDIT
Connection code
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'port' => 3306,
'login' => 'root',
'password' => '',
'database' => 'glectoMVC',
);
}
Also - If I look at the cakePHP generated startup page it confirms that my database connection is OK.
Managed to figure it out:
Apparently CakePHP isn't too happy with localhost as a host name. Instead I changed it to 127.0.0.1
Sup dude. this does look like mysql isn't running. Mainly as it's stating a can't connect and not a credentials fail. What LAMPP Stack are you running?
If all else fails and the LAMPP app you're using states the process is running successfully, ensure you haven't two instances of mysql running asynchronously.
I put my files on my server, but I'm unable to connect to the database. My project works on my local machine, but not on my production server.
I'm using mysql and php.
I'm getting this error:
[01-Nov-2010 18:27:01] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'dbuser'#'localhost' (using password: YES) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 20
[01-Nov-2010 18:27:01] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: Access denied for user 'mysite'#'localhost' (using password: NO) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 21
[01-Nov-2010 18:27:01] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: A link to the server could not be established in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 21
[01-Nov-2010 18:27:01] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'mysite'#'localhost' (using password: NO) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 28
[01-Nov-2010 18:27:01] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 28
[01-Nov-2010 18:27:01] PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 31
[01-Nov-2010 18:27:01] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 46
Does this error mean that my password is incorrect? Any suggestions?
Thank you.
-Laxmidi
Either your user or password is wrong (or even your server, but that's more rare).
Be aware that there are two users on that stacktrace, 'dbuser' and 'mysite', could be related to that?
Thank you for the help. I made a dumb error. My host prefaces the user name and the database name with the site's user name in order to avoid conflicts. I forgot about that.