Very slow PHP with XAMPP on Windows

We use XAMPP on a few machines to quickly test some PHP scripts. Upon upgrading to the latest version of XAMPP, everything slowed to a halt. It turns out that the database connection was slowing down the scripts in phpMyAdmin, and our custom scripts. We just added a line to our phpMyAdmin config.inc.php, and adjusted the database connection strings in our custom scripts to fix things.

The line in config.inc.php:

$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;

Our custom scripts were fixed by using 127.0.0.1 instead of localhost.

(On a side note, we had already changed our hosts file & ruled that out as a problem prior to changing these values.)

Great thanks to EllisLab for the phpMyAdmin tip.

Read More

Yii Framework Easy Test Fixture Creation

We’ve said it before, and we’ll say it again – we are huge fans of the Yii Framework.  This PHP framework is easy to understand, and even better, easy to create test cases.  One of the most time consuming portions of writing the test suite, however, was getting your test data into Yii’s ‘fixture’ files.  These fixture files correspond to data that would be in your database tables, but the files stay constant so you always have a known start state.  That way, you can test your application easily at any time, ensuring that your recent build hasn’t broken any legacy functions.

Due to the fixture files, we had resorted to running a custom script that took data out of our production database and exported it to a fixture file.  However, with a recent new installation of phpMyAdmin, we came across the PHP Array plugin.  Using this plugin, you can easily export your table data into PHP array format – the same format that is needed for your Yii fixture files.

We hope this saves someone some time and hassle down the road!

Read More