Solved

Linux PHP/Propel Error

Posted on 2012-12-30
11
398 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 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Creating and Managing Databases with phpMyAdmin in cPanel.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

947 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

22 Experts available now in Live!

Get 1:1 Help Now