Articles
Compare phpinfo's Across Two Servers
Work Environment
For work, I have to set up my own development environment that is able to run my employer's code on my own laptop. It's PHP/MySQL, so it's a simple LAMP setup.
sudo aptitude install apache2 php5 mysql-server libapache2-mod-php5 php5-mysql php5-curl phpmyadmin
Of course, then I have to modify some config files, pull down the MySQL DB for testing and change the document root.
But wait, what about the settings in PHP? Remember magic quotes or register globals? Well installing PHP 5.3 in Ubuntu 10.04 Lucid Lynx, these are of course turned off by default, but my work requires them. What about other settings though? I don't want to have to keep chasing bugs as I try and develop/hack on my employer's code. Luckily I had this exact same problem with another employer and came up with a solution: compare two phpinfo files.
<?php phpinfo(); ?>
This function is a special function in PHP that dumps environment and config information into a table. The problem is, when it comes to comparing two from different servers, it's long and the markup is extensive.
The Script
The code I use are recycled functions found on the Internet (referenced of course) mixed in with some cURL and loops. The script is able to fetch two phpinfo files from any web accessible URL, including ones that need an htaccess (also known as basic authentication) password, and spit out differences between the two files.
You can download the code and see an example of two readily accessible phpinfo files found on the Internet (note: don't make your phpino file readily accessible on the Internet). Just make sure to edit lines 313 and 314 to the two phpinfos you need to compare and run.
If you see a blank screen, it's probably because php5-curl isn't install. Run
sudo aptitude install php5-curl
Good luck!

Pingback: Brett Alton: Compare phpinfo’s Across Two Servers | TuxWire