It's my first time learn hosting for my final assignment
i got this error - Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' in /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/library/Zend/Db/Adapter/Pdo/Abstract.php:143 Stack trace: #0 /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/library/Zend/Db/Adapter/Abstract.php(414): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/library/Zend/Db/Adapter/Pdo/Abstract.php(220): Zend_Db_Adapter_Abstract->query('select sum(JumD...', Array) #2 /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/library/Zend/Db/Adapter/Abstract.php(660): Zend_Db_Adapter_Pdo_Abstract->query('select sum(JumD...', Array) #3 /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/application/models/DataCart.php(30): Zend_Db_Adapter_Abstract->fetchRow('select sum(JumD...') #4 /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/application/contro in /home/vol13/000space.com/space_4876282/htdocs/CakeShopOnline/library/Zend/Db/Adapter/Pdo/Abstract.php on line 143
I have no idea what should i do
I get no error when i'm on local..
18 10856
It might be that you don't have the database connection credentials set correctly for the hosting site.
You probably have settings like: localhost on your home system and the external host might need to point to an external MySQL machine. If MySQL is on an external box, you can't specify using UNIX sockets - you have to use TCP/IP.
As you might imagine, you'll have to do some digging and this is the nature of the beast that you've elected to get involved with.
[Computers can be a REAL PAIN! ;-)]
It also might be that mysqld.sock is in a different location on the hosting server or it's named something else.
If you have SSH access (and you know how to use it) try this command:
find / -iname "mysql*.sock".
Or you can try this to see how MySQL is actually connected.
netstat -ln | grep mysql
I'm running a CentOS box locally and it's located in: /var/lib/mysql/mysql.sock. Many times it's in the /tmp/ directory.
You can also ask the hosting company's tech support - they may have an answer because this is a common problem.
There are a number links you can find by Googling that address this issue.
One of possible interest is: http://lenss.nl/2009/06/zend_db-conn...-mysql-socket/
Finally, Zend's adapter has had known issues in the past, but I assume you're setup is up to date.
uhm,
i'll try now >.<
thank you so much ^^
but my web use database to show catalog too
and the catalog can shows normally just like in local
i'm really confuse x__x
@AngelinaB
I'm unclear on what you're asking in the above...
Angelina please write in complete sentences with proper punctuation so that other members can understand what you are trying to say.
sorry for my bad english
I was sick so could not think clearly.
I'm trying to say that my website using sql query to display the items in the catalog and I did not get an error like the login process ( error above)
once again sorry for my bad english.
AngelinaB,
I don't know the particulars of your application; especially that which is related to the 'catalog', so it's impossible to advice you without more information.
Can you explain a little about your course, what your trying to accomplish at this juncture in the class, what the requirements are, etc.?
Best,
hi2..
oc. i'll try to explain but i'm really sorry for my bad english..
my final assignment is make an ecommerce website (study case)
on my main page there are sections to login and recommended items.
on recommended items I did the calculation of the database by looking for the best-selling items (and I do not get an error) but if I try to login I get an error as above.
that's make me so confuse..
btw thank you very much for your replies..
I'm sorry I forgot to say thank you earlier
You obviously can connect to the database for doing the calculation, so... it might be that you're using a different connection modality to connect to the database when attempting the login...
Why don't you post some of the code; sans username and password?
Aren't you using he Zend abstraction layer?
As a matter of fact, post the code you use when connecting to do the calculation along with the code for logging in...
Try an online beautifier for the code and of course embed that in a [ code ] ... [ /code ] pair.
Beautifier - one of many: http://beta.phpformatter.com/
hi..
yes sir, i'll do..
this is my code for calculation -
//controller
-
$sj= new DataTrans();
-
$jml = $sj->getjmlmostbuy();
-
$this->view->dmostbuy=$sj->getmostbuy2($jml);
-
-
//model
-
function getjmlmostbuy() {
-
$DB = new Zend_Db_Adapter_Pdo_Mysql($this->__construct());
-
$sql="select max(A.cnt) as jml ";
-
$sql=$sql."from( Select sum(dt.JumDItemDTrans) as cnt ";
-
$sql=$sql."from DTrans dt, DItem di ";
-
$sql=$sql."where dt.IdDItemDTrans = di.IdDItem ";
-
$sql=$sql."group by (di.IdDItem)) as A ";
-
$data=$DB->fetchRow($sql);
-
return $data['jml'];
-
}
-
function getmostbuy($jml)
-
{
-
$DB = new Zend_Db_Adapter_Pdo_Mysql($this->__construct());
-
$sql="select di.IdDItem as iditem, di.NamaDITem as namaitem, di.UkuranDItem as ukuranitem, ";
-
$sql=$sql."di.HargaDItem as hargaitem, sum(dt.JumDItemDTrans)as jumlahitem ";
-
$sql=$sql."from DTrans dt, DItem di ";
-
$sql=$sql."where di.IdDItem = dt.IdDItemDTrans ";
-
$sql=$sql."and sum(dt.JumDItemDTrans) = '".$jml."'";
-
$sql=$sql."group by di.IdDItem ";
-
return $DB->fetchAll($sql);
-
}
-
and this is my code to loggin -
//controller
-
if ($this->_request->isPost())
-
{
-
Zend_Loader::loadClass('Zend_Filter_StripTags');
-
$f = new Zend_Filter_StripTags();
-
$user = $f->filter($this->_request->getPost('user'));
-
$pass = $f->filter($this->_request->getPost('pass'));
-
if (empty($user))
-
{
-
$this->view->message = 'Insert UserName.';
-
} else
-
{
-
//check admin dlu
-
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
-
$db = Zend_Registry::get('db');
-
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
-
$authAdapter->setTableName('Admin');
-
$authAdapter->setIdentityColumn('NamaAdmin');
-
$authAdapter->setCredentialColumn('PassAdmin');
-
// Set the input credential values to authenticate against
-
$authAdapter->setIdentity($user);
-
$authAdapter->setCredential($pass);
-
// do the authentication
-
$auth = Zend_Auth::getInstance();
-
$result = $auth->authenticate($authAdapter);
-
if ($result->isValid())
-
{
-
// success: admin
-
$data = $authAdapter->getResultRowObject(null,'password');
-
$auth->getStorage()->write($data);
-
$identity = $auth->getIdentity();
-
$_SESSION['nmuser']=$user;
-
$_SESSION['username']=$user;
-
$_SESSION['userid']=$id;
-
$_SESSION['userlvl']=1;
-
$this->view->link='logout';
-
$this->view->links='Log Out';
-
$this->view->index='1';
-
$this->_redirect('/admin/admin');
-
} else
-
{
-
//check user
-
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
-
$db = Zend_Registry::get('db');
-
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
-
$authAdapter->setTableName('User');
-
$authAdapter->setIdentityColumn('EmailUser');
-
$authAdapter->setCredentialColumn('PassUser');
-
// Set the input credential values to authenticate against
-
$authAdapter->setIdentity($user);
-
$authAdapter->setCredential($pass);
-
// do the authentication
-
$auth = Zend_Auth::getInstance();
-
$result = $auth->authenticate($authAdapter);
-
if ($result->isValid())
-
{
-
$data = $authAdapter->getResultRowObject(null,'password');
-
$auth->getStorage()->write($data);
-
$identity = $auth->getIdentity();
-
$id= $identity->IdUser;
-
$DataUser = new DataUser ();
-
$nmuser = $DataUser->searchnmuser($id);
-
$_SESSION['username']=$user;
-
$_SESSION['userid']=$id;
-
$_SESSION['nmuser']=$nmuser;
-
$_SESSION['userlvl']=2;
-
$_SESSION['status']='login';
-
if(isset($_POST['remember'])){
-
setcookie("username", $_SESSION['username'], time()+60*60*24*60, "/");
-
setcookie("userid", $_SESSION['userid'], time()+60*60*24*60, "/");
-
setcookie("nmuser", $_SESSION['nmuser'], time()+60*60*24*60, "/");
-
setcookie("userlvl", $_SESSION['userlvl'], time()+60*60*24*60, "/");
-
}
-
-
//tampilkan bnyak item dari dtcart sesuai user d menu
-
if ($_SESSION['userid'] != '') {
-
$DataCart = new DataCart();
-
$this->view->jumcart = $DataCart->getjumitemcart($_SESSION['userid']);
-
}
-
$this->view->link='logout';
-
$this->view->links='Log Out';
-
$this->view->index='1';
-
} else
-
{
-
// failure: clear database row from session
-
$this->view->message = 'Login Failed';
-
$this->view->index='0';
-
}
-
}
-
}
-
}
-
thank you for helping and sorry to bother you ..
how embarrassing me U__U
yes sir, have a lot of good rest
once again thank you for helping ..
A...
By the way... The [ code ] ... [ / code ] are without spaces...
I just showed it that way because it wouldn't show on the screen otherwise...
At least you're listening! :-)
I'm probably about to fade and will be back up in a few hours... I've been up for about 20 hours.
---- At which line in the code are you getting error?
i've edited it >.<
have a good rest sir..
Did you get it to work?
I'll be up for another 30 minutes...
By the way... It's cool you're learning MVC and Patterns...
If you like this work, you'll definitely find a good place in the field.
I know a bunch of great female geeks (Gerds) that are doing great stuff in the field.
Check this out: http://girldeveloper.com/ - Sara's really cool and funny ta boot!
hmm my reply doesnt entered x__x'
no sir.. it's still error and the error on the above always bold in this code -
/home/vol13/000space.com/space_4876282/htdocs/CakeSh
-
opOnline/library/Zend/Db/Adapter/Pdo/Abstract.php
-
on line 143
-
I really don't know where is the wrong section and tomorrow is my final assignment trial, it's seems I had to demostrate through virtual host >__<
but I will keep trying to find out where my mistake because I was really curious so please help me again sir, it's alright?
yes sir, i do like php programming and it seems I still have to learn a lot..
so please guidance me :D
woghhhh that was a cool web.
if sara real sir? sara looks great >__<
Just start inserting print statements starting at this line:
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable' );
something like this: -
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
-
-
/* Debugging */
-
print "Got Here!";
-
exit;
-
/* Debugging */
-
-
$db = Zend_Registry::get('db');
-
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
-
$authAdapter->setTableName('Admin');
-
$authAdapter->setIdentityColumn('NamaAdmin');
-
$authAdapter->setCredentialColumn('PassAdmin');
-
// Set the input credential values to authenticate against
-
$authAdapter->setIdentity($user);
-
$authAdapter->setCredential($pass);
-
// do the authentication
-
$auth = Zend_Auth::getInstance();
-
...
-
And continue to move the print (debugging) statement down until you get the failure.
I assume you'll get it on the first line.
On a another note...
Where is the class DataTrans defined?
$sj= new DataTrans();
Somewhere in its execution path a connection is obviously getting instanced properly, but I do understand the need to create the authentication construct in the login part.
Maybe therein you'll find some differences in connection configurations, but I'd think they should be compartmentalized in one place - as I know is the normal case. But I've written some pretty squirrelly code myself that I've had to wonder what idiot wrote it! :-)
uhm..
my post doesn't entered again x__x'
hi..
I've written classes that are needed in index.php
and DataTrans defined in models area
this is my code in DataTrans -
<?php
-
require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
-
require_once 'mysql.php';
-
class DataTrans
-
{
-
public function __construct()
-
{
-
$params = array(
-
'host' => dbHost,
-
'username' => dbUser,
-
'password' => dbPass,
-
'dbname' => dbName
-
);
-
return $params;
-
}
-
//another function..
-
}
-
i've defiend all of parameters in construct too like this -
define('dbHost','sql213.000space.com');
-
define('dbUser','space_4876282');
-
define('dbPass','xxxx');;
-
define('dbName','space_4876282_dbname');
-
that's all sir..
i still wondering where is the differences connection setting that cause error in the login area x__x'
thank you sir for helping me..
Haven't forgotten you... I'm just now going to bed... :-)
hi2..
hahah.. thank you sir..
sleep tight sir..
I've actually graduated yesterday
but I'm still curious about the above error ..
but I'll keep trying again to fix an error on the right
by the way thank you very much sir and sorry to bother you..
Sign in to post your reply or Sign up for a free account.
Similar topics
by: D. K. |
last post by:
Hi;
I have installed suse 8.2 a short while ago and at my first attempt to connect mysql (via shell and a perl dbi script) i get following error:
can't connect to mysql server through socjet...
|
by: Matthew Robinson |
last post by:
i get this when i do '/etc/rc.d/rc.mysql start'
ERROR 2002: Can't connect to local MySQL server through socket
'/var/run/mysql/mysql.sock' (2)
ive had a look on google, and the problem for...
|
by: Ian |
last post by:
Dear All,
I just downloaded & installed MYSQL. It seemed to work and I can start
it and enter my password and change a directory but that is about all.
I have been ready and playing "hit & miss"...
|
by: Pugi! |
last post by:
On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get
the following problem when connecting to mysql through a browser
(phpMyAdmin):
:
#2002 Can't connect to local MySQL...
|
by: jiing |
last post by:
Now let me describe what I have done and my purpose:
Originally, I want to user ports to install phpBB
But I found that phpBB doesn't support mysql 5.x (but the ports
installed mySQL 5.0.0...
|
by: linux |
last post by:
Sorry if this is a really dumb question. I am trying to connect to our
remote MySQL server (which is running just fine). I have a perl script
which
worked just fine on my other Fedora 4 box (all...
|
by: Michal Stankoviansky |
last post by:
Hi
Environment: some version of Slackware, Apache 2.2.x, PHP 5.1.5, MySQL
5.0.24.
The issue: I'm using Zend Framework Zend_Db component (which uses PDO).
We have 2 mysql socket related...
|
by: hubcolyn |
last post by:
i have just installed suse linux 10.0, when i run the command mysql -p, it prompts me for a password which i dont know so i press enter i get the following:
error 2002 (HY000) cant connect to...
|
by: Christian |
last post by:
Hi,
Trying to connect to the MySQL server I get the classic error message
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)
I have...
|
by: sasimca007 |
last post by:
Hi friends,
I installed mysql in ubuntu but, i don't know how to connect to that mysql. Actually we connect to postgresql by psql command, but when i tried to connect mysql with...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |