Solved

Linux PHP/Propel Error

Posted on 2012-12-30
11
412 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
Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

623 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