I’m running ExpressionEngine 2 (Build 20101220) and have a calendar that is maintained separately from my EE site in another MySQL database on a different server. This calendar works without any problems as I’ve tested it with plain old PHP pages. Now that I’m switching the site to EE, I’d like to pull it in to the home page template with a require statement. The snippet of the calendar pulled in for the home page is just static info pulled from the database. Anyways, when I use my require statement, I get the error:
A PHP Error was encountered Severity: Warning Message: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) Filename: includes/calendar_db_functions.php Line Number: 8 Could not connect
So I know it is seeing my files as its referencing an error in a function I wrote to connect to the other DB. I’ve been able to find info on this particular socket error online but all of the info I’ve found has been about having this problem with your main EE DB.
So what would be the protocol for connecting to another DB on a different MySQL server than my EE install? I’ve also read some tips that for this functionality I should just make my calendar a plugin for EE however this isn’t an option. This is a separate, very robust calendar with its own backend that a client paid to have developed and they want to continue to use it. So I need to somehow bring it into EE. If I can’t connect to the DB through an EE template, should I use an iFrame?
Anyways, I’m really lost here as this is my first time running into this issue so any help would be greatly appreciated!! If you need anymore info I’d be happy to provide, you can email me at [brian at invexdesign dot com]. Thanks in advance for any help!
So what would be the protocol for connecting to another DB on a different MySQL server than my EE install?
So this is about using PHP in an EE template to connect to an external database, correct?
This is a separate, very robust calendar with its own backend that a client paid to have developed and they want to continue to use it.
That’s fine, but couldn’t it use the same database as EE, still using its own tables and all? It’d be much easier to access that way.
Yes, this is regarding connecting to an external database from PHP within EE. There are two sections of the site that will bring in info from this database. A snippet on the homepage for daily calendar which can be seen here: CCM - Beta Home Page and a full calendar page here: CCM - Beta Full Calendar Page
I don’t think moving the calendar database will be a viable option. Would you recommend possibly bring in an iframe for the home page daily calendar?
As for the Full Calendar page, if you interact with it (ie click dates on the mini calendar), you’ll see it uses query-string URLs. Is there any way I’d be able to do this page within an EE template? For this page, I was basically assuming I’d have to just have a separate PHP page for the full calendar, not through EE. Any thought? Thanks again!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.