Debugging Propel on 1and1

I’ve switched the MyHealth program to use the Propel Object Relational Mapping tool. I like the way it generates code at build time so should be fast. It cuts down on the code I have to write and makes things easier to understand. It also introduces me to the world of PHP Namespaces and finding out how Propel have used an autoloader to load classes on demand. All this makes PHP a little more Java-like.

One change that could be made made is to allow the configuration builder to build multiple configurations. Currently I run a build with the dev configuration file, then change some lines in the file to run again with the production file. My code switches between the two at runtime depending on whether it’s running at home on my own database or on 1and1’s server on theirs.

Care must be taken to catch Exceptions! The Exception produced by Propel if it fails to connect to the database includes information about the parameters it attempted to use. This would be quite catastrophic. The password I have used is only useful for that database, which can’t be reached from outside 1and1’s servers. It still could allow an attack from a customer who has or buys a 1and1 account. I’ve not seen a way to create users on the database with limited privileges so that password gives full access.

Currently the application is down, and here lies the biggest problem I’m having. 1and1 don’t seem to give me access to the server error logs. An alternate error handler does not seem to work. I’ve been left using the “Roving print(“DEBUG”)” technique to effectively step through the code to see which line is failing. I believe my application is connecting to the database because if I change the configuration to use invalid credentials I see an Exception. The application does work at home. So now I need to try to work out why it is failing, or try something other than Propel.

Another difficulty I have had is testing against Facebook from home. Facebook limit the referrer addresses that an application can call from, and “localhost” cannot be set as valid. Maybe Facebook provide a developer mode that I’m not aware of – one that allows access from any host but restricts it to my user ID. That would be very useful as then I can develop and debug at home.

1 thought on “Debugging Propel on 1and1

  1. I have moved from Propel to Doctrine, so now have a database layer that works on my ISP. I don’t have the APC cache extension, so something to look into.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.