php-general Digest 12 Jan 2013 16:13:19 -0000 Issue 8095
php-general Digest 12 Jan 2013 16:13:19 - Issue 8095 Topics (messages 320064 through 320065): Re: Expansion of Apache definitions 320064 by: Sebastian Krebs اÙسÙر ٠اÙع٠٠باÙخارج ٠ع اÙبر اÙشرÙات اÙعاÙÙ ÙÙ 320065 by: www.arca24.com Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- 2013/1/10 John Iliffe john.ili...@iliffe.ca I recently made a posting on the Apache users group regarding recovering the client IP address using the $_SESSION['REMOTE_ADDR'] function in PHP. I received the following caveat from another developer: -start quote You may want to update that. Since 2.4, apache makes the distinction between the the two different REMOTE_ADDR candidates: the peer making the TCP connection, and the client making the HTTP request. In other words, the nearest proxy and the end-user. The latter is of course very easy to spoof, but is nevertheless the one most applications want. --end quote Is there any development underway in PHP to have both of these addresses available in the $_SESSION global variable? It's only semi-official, but the whole proxy chain is usually available in X-Forwarded-For. Regards, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- github.com/KingCrunch ---End Message--- ---BeginMessage--- Hi, employers are looking for you if you are looking for a new job go to www.arca24.com the Swiss career portal that let the employers find you . What arca24.com gives you to find the right job: - Post your Cv for FREE - Active you personal Job Agent, that sends you a message every time that some one post a job ad interesting for you - Apply to a lots of jobs everyday everywhere - Respect the highest standards of your data privacy Don’t lose time post your cv: http://www.vipcontact.org/vipc/link.php?M=3723687N=31L=7F=T 73% OF EMPLOYERS SEARCH CVs FIRST. INSTEAD OF POSTING JOB ADS, POST YOUR CV NOW, MAKE SURE IT CLEARLY DETAILS YOUR SKILLS, EXPERIENCE LET THEM FIND YOU KNOW YOU ARE THE BEST CANDIDATE. Our reference is Swiss quality process and international recruiter experience. Try it. Best regards هل تبحث عن عمل فى الخارج اركا24 السويسريه تساعدك اذا كنت مؤهل فإن اصحاب الاعمال يبحثون عنك انشأ سيرتك الذاتيه مجانا لدينا العدبد من فرص العمل فى دول الخلبج العربى مع تمنياتنا بالتوفيق Click this link to unsubscribe: http://www.vipcontact.org/vipc/unsubscribe.php?M=3723687C=d6682ffba4462cef4db159ed3441b2f1L=45N=31 ---End Message---
[PHP] Can't connect to MySQL via PHP
Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1… both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't connect to MySQL via PHP
On January 12, 2013 11:25:58 AM Rick Dwyer wrote: Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1… both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick are navcat and php on the same machine? mysql user accounts can and often do take into account which machine the connection is comming from? $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
-Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
On Jan 12, 2013, at 3:56 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Could not connect: Access denied for user 'user'@'localhost' (using password: YES) Using mysqli_ returns the same error message as well. --Rick --Rick
Re: [PHP] Can't connect to MySQL via PHP
On 1/12/2013 1:28 PM, Rick Dwyer wrote: On Jan 12, 2013, at 3:56 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Could not connect: Access denied for user 'user'@'localhost' (using password: YES) Using mysqli_ returns the same error message as well. --Rick --Rick Isn't that just telling you that the uid is not defined for the proper access to any mysql db? It's been awhile since I set my accesses up so I can't remember. I have one user that I use to do all my connections with. That user is declared for each db with full access. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui
RE: [PHP] Can't connect to MySQL via PHP
admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can't connect to MySQL via PHP
On Sat, 2013-01-12 at 19:53 +, Ashley Sheridan wrote: admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk Sorry, just re-read the OP and realised he was using the mysql_* functions. I still stand by my statement of not using them though. People should be advised that the functions are deprecated fully now and are not safe to use. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
Simple test I just did. A simple script that first connects to mysql and then tries to select a db. With a uid/pswd that I just made up for the script, I get the following: Error - Could not connect to database from sql_db_connect Access denied for user 'albany_ginerjm3'@'localhost' (using password: YES) Going into my host's mysql manager, I created the uid/pswd to match what my script has in its code. The next execution returns this: Error - Could not select database in sql_db_connect Access denied for user 'albany_ginerjm3'@'localhost' to database 'albany_jgfiles' Going back to my mysql manager, I added the new user to the db that I am trying to select. No more error messages. I would check that the user is defined to access the db that you are trying to use, if not all the dbs you have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't connect to MySQL via PHP
I agree. Thanks Ash. Always good recommendations from your end. On Sat, Jan 12, 2013 at 3:03 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Sat, 2013-01-12 at 19:53 +, Ashley Sheridan wrote: admin ad...@buskirkgraphics.com wrote: From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Saturday, January 12, 2013 10:03 AM To: admin Cc: 'Rick Dwyer'; php-general@lists.php.net Subject: RE: [PHP] Can't connect to MySQL via PHP On Sat, 2013-01-12 at 12:56 -0800, admin wrote: -Original Message- From: Rick Dwyer [mailto:rpdw...@earthlink.net] Sent: Saturday, January 12, 2013 8:26 AM To: php-general@lists.php.net Subject: [PHP] Can't connect to MySQL via PHP Hello all. I used the code below successfully to connect to a MySQL db on one hosting provider. I've moved the code to a new hosting provider with new values and it returns: Access denied for user 'user'@'db.hostprovider.net' (using password: YES) Even though I can copy and paste these three values (host, user and pass) and paste into Navicat to make a connection. So the credentials are correct, but they are not authenticating when used in PHP. I've tried making host localhost and 127.0.0.1. both with the same result. Can someone tell me what I am doing wrong here? Appreciate it. Thanks, --Rick $db_name = mydb; $vc_host= db.hostprovider.net; $vc_user= user; $vc_pass= pass; $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db = mysql_select_db($db_name, $connection); echo mysql_error(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try this for me --- $db = mysql_connect($vc_host, $vc_user, $vc_pass); mysql_select_db($db_name, $db); if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db); Please at least use mysqli_* functions. Every time someone recommends we use mysql_* functions, a kitten kills a programmer. Thanks, Ash http://www.ashleysheridan.co.uk Ash, The question was asked about mysql functions. As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui Actually, the question never mentioned mysql_* functions, so telling someone to use them is wrong. Thanks, Ash http://www.ashleysheridan.co.uk Sorry, just re-read the OP and realised he was using the mysql_* functions. I still stand by my statement of not using them though. People should be advised that the functions are deprecated fully now and are not safe to use. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Can't connect to MySQL via PHP
On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com wrote: As much as the php list would like to force people from using mysql, I guess you should not have invented it, if you don't want people to still use it. It's not this php list. It's the php developers. mysql* functions are set to be removed in a release coming soon. Time marches on. mysql* functions were written first, then the mysqli* functions were written. mysql* is old, out of date, and not begin supported. Should not have written it? Maybe? But maybe no libraries should have been written, nothing should move forward, better ways should not have been found. Maybe you want to do your computing using pebbles, too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php