LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-03-2011, 04:19 AM   #1
JasonBright
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
Exclamation PHP Session error on linux


Hi, I'm new to hosting websites on linux servers and I saw that it's a bit different than windows servers.

I have a website that works perfectly on local, but that doesn't work anymore on my webhost.

The exact error message is:
Quote:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'syste136'@'localhost' (using password: NO) in /home/syste136/public_html/mescommandes.php on line 16
Could not connect: Access denied for user 'syste136'@'localhost' (using password: NO)
Now I saw on internet that a php.ini file would probably solve this issue, but I really don't have time to learn how it works.

Do any of you have an ini file ready for use ?
 
Old 03-03-2011, 04:45 AM   #2
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
This has nothing to do with Windows or Linux.

Do you have the mysql user "syste136"?

You didn't use any password... Is this how the user was made?

Do you have just a simple "mysql_connect()" line in you php files and expect to use the default user and password from php.ini.

The unrecommanded way of connecting to the database is by editing your php.ini. Basically you need to set up at least "mysql.default_user=" and "mysql.default_password=". This is however a global setting and is recommanded only if you use just one custom made web-site.

The recommanded way is by passing these values on every attept to connect. Like this "mysql_connect(host,user,name)" (assuming your not using mysqli).

One last recommandation, if you don't mind: Make time. This is a simple issue. If you don't have time for something like this than probably you don't have time and ignored a lot of other stuff too (some may be with harmfull results).
 
1 members found this post helpful.
Old 03-03-2011, 06:53 AM   #3
JasonBright
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Smokey_justme View Post
Do you have the mysql user "syste136"?

You didn't use any password... Is this how the user was made?
No, I don't have a "syste136" but a "syste136_admin". I don't understand that either.
But I do have a password.

Quote:
Originally Posted by Smokey_justme View Post
Do you have just a simple "mysql_connect()" line in you php files and expect to use the default user and password from php.ini.
No, I use session variables for that, like that:
Code:
//Starts session
@session_start();

//Database settings [Server]
$_SESSION['host'] = '127.0.0.1';
$_SESSION['database'] = 'database';
$_SESSION['user'] = 'syste136_admin';
$_SESSION['sql_password'] = 'pass';
Quote:
Originally Posted by Smokey_justme View Post
One last recommandation, if you don't mind: Make time. This is a simple issue. If you don't have time for something like this than probably you don't have time and ignored a lot of other stuff too (some may be with harmfull results).
Well I don't have time to look at it now because of the due date for the project, but I sure will make the time once it's finished !

Last edited by JasonBright; 03-03-2011 at 06:54 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
session problem in php on linux redhat enterprise websoftexpert Linux - Newbie 1 07-21-2006 08:33 AM
php session richard22 Programming 2 10-26-2004 05:50 AM
PHP session control lhoff Programming 3 05-06-2002 12:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration