Software Mirepoix: Apache - PHP - MySQL Installation Notes
With the index data load organized — if not actually done — it was onto the development of a PHP form to provide the user interface into the keyword search capability. The form will initially be extremely simple — it will allow users to enter search terms which will be captured and passed to SimpleDB through the SimpleDB PHP library. To get this done, it really was time to get that jaunty software mirepoix of Apache, PHP and MySQL installed, up and running in the development environment. (See Code Shavings, below for specifics of the packages installed.) The installation was more-or-less trouble free, with the possible exception of integrating the SimpleDB PHP library with the development environment. To help others avoid the same mistakes, here are a couple of tips;
- First things first; ensure PHP error messages are turned on! Specifically, check the line which looks like
display_errors = Offin the php.ini file, and change it todisplay_errors = On. Eventually it will be turned off again if and when the server goes production, but for development, it’s essential to be able to see all the error messages being thrown off the code. - Remember to restart Apache after making the change above, or it may not have the immediate effect you expect*. The version of Apache installed provides an icon in the Windows Task Bar which enables a two-mouse-click Apache restart.
- Do yourself a favour and write up a little PHP code to display the
phpinfo(), such as shown below. It will provide a nicely formatted summary of the current configuration of PHP. It was essential for figuring out the wayinclude_pathwas being set, for example.
<HTML> <?php print phpinfo(); ?> </HTML>
With respect to the SimpleDB PHP Library itself, the experience has to be filed under ‘be careful what you wish for’. One of the pitfalls of being in the SimpleDB beta group is it becomes clear the documentation and other support tools are only just coming together. There is a lot of trial and error, and Googling error messages provides few hints which are useful. These are early days for SimpleDB and it’s associated PHP Library. Some hints;
- The examples provided require a lot of editing before they actually work. As someone else noted in the forum, there is room for a Hello World application to touch on all the aspects necessary to get an example working. The code immediately below is what the sample file contains, followed by what it needs to look like in order to actually work;
// @TODO: set request. Action can be passed as Amazon_SimpleDB_Model_GetAttributes
// object or array of parameters
// invokeGetAttributes($service, $request);
$request = new Amazon_SimpleDB_Model_GetAttributes();
$request->setDomainName('Document');
$request->setItemName('874C863D-FA06-4D2E-8C25-104B317623BD');
$request->setAttributeName(array('tokenTxt', 'urlTxt'));
invokeGetAttributes($service, $request);
- Until such time PHP errors were turned on and it was possible to see exactly what was going on, a ton of time was spent fiddling with the
set_include_pathin.config.inc.phpin the Samples folder, and also withinclude_pathin the php.ini files. It was assumed lack of error messages meant the code library wasn’t being accessed for some reason. Once I had errors turned on, it was quickly determined there were no changes required to either statement related to the PHP execution path. - The SimpleDB PHP library may be buggy — at least one problem was referred to the forum. All of the calls to Client.php come back with warning;
Undefined index: port in C:\...\Amazon\SimpleDB\Client.php on line 411. - Up until now, Notepad and Wordpad were the text editors of choice. Once again, do yourself download a more fit-for-purpose, quality editor such as Notepad++. The difference in productivity is like night and day.
It is tempting to say "Apart from that, Mrs. Lincoln, how did you enjoy the show?" It always seems worse at the time, but truth is, getting the mirepoix set up will take a solid afternoon of futzing around, but then it’s away to the races. And the price is certainly right.
Code Shavings Much thanks to Edward’s Web Developer Site for an overview on setting up the development environment. ♦ The specific packages and versions were as follows; Apache (apache_2.2.9-win32-x86-no_ssl-r2), PHP (php-5.2.6-win32-installer), MySQL (mysql-5.0.67-win32), MySQL GUI Tools (mysql-gui-tools-5.0-r12-win32) and MySQL Workbench (mysql-workbench-oss-5.0.24-win32). ♦ Interestingly enough, the MySQL GUI tools download from Canadian mirror sites would not install, but the one from the Open Source Lab at OSU seemed to work just fine. Go Beavers.
*If PHP is running as a module — it is, in this case — a restart of Apache is required. If it’s running as a CGI then the restart is not technically required. But then again, a restart can’t hurt, either.
Posted on 28th August 2008
Under: Developers' Journal | 2 Comments »


