views:

89

answers:

2

Every so often, things work in my local PHP development environment, while in my test environment on my server, things do not. It's a nightmare to debug this. If I had a console like Rails provides, debugging would be much much simpler.

Is there anything like the Rails console but for PHP?

I should mention that I am using a home-brewn PHP application.

+2  A: 

PHP has a basic interactive shell available by running php -a. It doesn't have the bells and whistles of a framework-based console though.

More info can be found in the docs: http://docs.php.net/commandline.interactive

salathe
I think this is the closest thing to what I'm looking for.
Chad Johnson
+1  A: 

Like webbiedave mentioned php is a language and Rails is a framework of Ruby. However, you could insert "break-points" into your php Script - and either execute from the browser - or if you have php-cli installed execute the script from CLI (Which isn't exactly the same as the browser, but may also provide more helpful information).

A few other tips - dump the environment settings for each machine, devel and production (with a simple script that has

<?php phpinfo(); ?>

And compare the differences - this may help highlight why certain portions are failing between environments.

Lastly you can run php interactively with php -a much like you can with irb and ruby though it may not be as helpful in this situation.

Marco Ceppi
The problem I experienced was actually due to bad data in the test database, so looking at the system configuration won't always help.
Chad Johnson