Solved

Linux PHP/Propel Error

Posted on 2012-12-30
11
397 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_
  • 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
 
LVL 82

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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 82

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now