Hi Everyone!
I'm new to linux-php-mysql (though I'm not new to programming/developing)... so bear with me!
I installed Ubuntu 9.04, then installed Apache, PHP and MySQL using...
sudo tasksel install lamp-server
I created a php page, and saved in /var/www/. But when I opened the page in firefox, i get the following error message...
Access denied for user 'www'@'localhost'(using password: no) in /var/www/index.php on line 12.
The code for the php page is as follows:
<?php
ini_set("display_errors", 1);
$mysqli = new mysqli("localhost", "root", "mysql1234", "TonyTestDB");
if (mysqli_connect_errno())
die ("Error connecting MySQL: ".mysqli_connect_error());
$sql1 = "call GetUsers()"; //GetUsers is a stored proc in MySQL
$query1 = $mysqli->query($sql1);
$rt = mysql_query($query);
echo "$rt[FName], $rt[SName], $rt[UName], $rt[PWord]<br />";
?>
Any ideas, because I've looked through countless forums to no avail, and this is driving me crazy!
Many thanks in advance,
Tony
access denied www-data
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: access denied www-data
OK, which is line 12? It helps if you put code between 'code' or 'php' tags.
Re: access denied www-data
Hi!
Thanks for your reply.
Well, I thought that this may have been the problem. I've changed the permissions on the /var/www/ folder over and over, but still with no success. As I said previously, I'm new to Linux, and I may not have set the correct permissions for the correct user/group. Could you advise me at all?
Cheers,
Tony
Thanks for your reply.
Well, I thought that this may have been the problem. I've changed the permissions on the /var/www/ folder over and over, but still with no success. As I said previously, I'm new to Linux, and I may not have set the correct permissions for the correct user/group. Could you advise me at all?
Cheers,
Tony
Re: access denied www-data
Hi!
Cheers for the reply.
Can you tell me where I'm mixing MySQL and MySQLi, please?
Many thanks in advance.
Cheers,
Tony
Cheers for the reply.
Can you tell me where I'm mixing MySQL and MySQLi, please?
Many thanks in advance.
Cheers,
Tony
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: access denied www-data
MySQL functions are prefixed with mysql
MySQLI functions (or objects) are prefixed with mysqli
MySQLI functions (or objects) are prefixed with mysqli
Re: access denied www-data
Hi!
Thanks for the reply!
Sarcasm is usually the lowest form of wit... however, I finally noticed where I was using a mysql function instead of a mysqli function. Sometimes you just can't see the wood for the trees!
Cheers,
Tony
Thanks for the reply!
Sarcasm is usually the lowest form of wit... however, I finally noticed where I was using a mysql function instead of a mysqli function. Sometimes you just can't see the wood for the trees!
Cheers,
Tony
Re: access denied www-data
Hi all!
A big thanks to McInfo for your help. I am new to php and the error message really had me running down the wrong path. Because of this I just wasn't looking at the code straight. However, I've now had a good look at the mysql and mysqli pages on the PHP website and all is well and good!!!
many thanks,
Tony
A big thanks to McInfo for your help. I am new to php and the error message really had me running down the wrong path. Because of this I just wasn't looking at the code straight. However, I've now had a good look at the mysql and mysqli pages on the PHP website and all is well and good!!!
many thanks,
Tony