Solved

Linux PHP/Propel Error

Posted on 2012-12-30
11
408 Views
Last Modified: 2013-01-20
I moved my app to another test server, this one is red hat linux.  It uses from mysql, propel and php.  I am getting this error, does anyone know how to resolve it?



An error occurred

Application error

Exception information:

Message: Unable to open PDO connection [wrapped: could not find driver]
0
Comment
Question by:Jack_son_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 13

Assisted Solution

by:themrrobert
themrrobert earned 167 total points
ID: 38731833
Yes, you have to install the php-pdo files from the yum repository. I can't remember exactly it's name, but

yum install *pdo*

Should do the trick.

Also, if you search for PHP in the add/remove software program and look for PDO you will find the software you need. (or Search for pdo and look for the php one, get it? )

Have fun :)
0
 
LVL 13

Assisted Solution

by:themrrobert
themrrobert earned 167 total points
ID: 38731845
You're also going to need the driver, if it's mysql, you'll need php-mysql or similar, that should take care of you :)
0
 

Author Comment

by:Jack_son_
ID: 38731851
Great, thanks, that error is gone, but now have this one:

Message: Unable to open PDO connection [wrapped: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)]


Also, I have the db on a different server, would this be part of the problem?
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 111 total points
ID: 38731964
Yes since your error message says 'local MySQL server'.  This is the connection method I use for MySQL PDO.  Put the IP address or domain name of your remote server in as $dbhost.

$dbdsn = "mysql:dbname=$dbname;host=$dbhost";
$dbh = new PDO($dbdsn, $dbuser, $dbpass);

Open in new window

0
 
LVL 11

Assisted Solution

by:mcnute
mcnute earned 222 total points
ID: 38732240
Mysql isn't menat to support cross server mysql connections. It is certainly possible to host your db on another server, but it takes a lot more time to load information through a constellation like that (mysql on one machine, website on another).

I strongly recommend you to install a mysql server on the machine your website is running and make up a localhost db connection to avoid heavy loading times.
0
 

Author Comment

by:Jack_son_
ID: 38732397
It can't run to a backend db server?  In this case we cannot use the db on an internet facing server so it is not a choice.
0
 
LVL 11

Assisted Solution

by:mcnute
mcnute earned 222 total points
ID: 38732410
in your host variable $host try to specify the ip address of the remote server of your db and then add the port/socket like so:

http://11.123.123.45:3306

Open in new window


3306 is the standard port for mysql connections.
0
 
LVL 13

Assisted Solution

by:themrrobert
themrrobert earned 167 total points
ID: 38732416
it absolutely CAN be run as a backend server, the error you describe is because the script is trying to access the local server via the file descriptor.
you might try a different library to access mysql, or just make sure all the connection info is correct.

your question is answered above, please close this question and start a new one with the details of your current problem, that will ensure you get the best help.
0
 
LVL 11

Assisted Solution

by:mcnute
mcnute earned 222 total points
ID: 38732437
you can find out about php mysql support methods running a phpinfo(); in a info.php file. There all of the drivers for mysql connection within php are listed.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 111 total points
ID: 38733118
No, no, I connect to MySQL servers over the network and over the internet all the time.  Many hosting companies put their databases on different machines.  You just have to set up the connections correctly.  

A MySQL server on the same machine that your code is running on can be connected thru 'localhost'.  All servers on other machines require either the IP address or the domain name (along with the username and password) to connect.
0
 
LVL 11

Accepted Solution

by:
mcnute earned 222 total points
ID: 38733129
Ok, i didn't know about that. I connected once a wordpress blog to a database on another machine and it took about three to four times loading the info out of the database into the blog as it did when the mysql server was on the same server. Maybe there is some network configuration in the mysql server to make before doing this, which I don't know of. But this constellation for me in that occasion was an aweful set up.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Duplicated data in GROUP_CONCAT 2 49
Update Set Column Query Not Working as Expected 6 42
Link Stopped Working 7 28
php non-object 7 21
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question