When running FlashBuilder, you have to have a server running on your local computer. This setup should reflect your remote server environment as closely as possible. But if you don’t have that luxury, here’s my notes on setting up my testing environment.

Installing WAMP

Download and install WampServer. You could actually use most setups of Apache, MySQL, and PHP on Windows, but this is the one I picked, without any research. It works well enough for testing Flex4 database connections. There are also similar setups for Apple (“mamp”) and linux (“lamp”); just Google it.

When it is installed, you will be able to go to http://localhost and will be presented with a webpage that has some information about what the server is running. One of the links on the page is called phpMyAdmin. This is how you set up and manage your database. There is also now an icon in the tray, which allows you to control various things, and restart the server.

Accessing the Zend Framework

Add this line to: {install directory}\bin\apache\Apachex.x.x\php.ini

include_path = ".;{install directory}\bin\php\php5.3.0\PEAR;{install directory}\www\ZendFramework\library"

You will have to make sure that this is the same as your Zend Framework root directory, though.

Setting Up MySQL Database and PHP Services

In order to access MySQL databases, you have to 1) create the database and tables, and 2) create a PHP service (Adobe’s term) to connect to the database.

To set up a sample, download this ZIP file. This contains some SQL files and a PHP file, in the sub-directories.

Warning: For PHP/MySQL, there are multiple versions of Adobe sample mysql database setups with their coordinated PHP services code. These versions are NOT compatible. If you have trouble with accessing the database, make sure that your SQL and PHP code refer to the same table structures. (SQL and PHP are both text files, and can be opened with any text editor.)

To setup your database, using either Database\testdrive_db.sql (if you have access to create databases) or Database\testdrive_table.sql (if you don’t have access to create databases). If you are using WAMP, you can use phpMyAdmin (found on http://localhost when your server is running). Use either the “SQL” tab and cut-and-paste the SQL instructions, or the “Import” tab. You should now have a working database. In phpMyAdmin, create a username and password for testing this database in Flex4.

For PHP setup, copy the file \TestDrive\services\EmployeeService.php to your website. Open your website’s copy, and change the $username, $password, $databasename, $port, and $tablename (get these from your database setup) as well as $server (get this from your local website setup). (These settings will change when you move your files to your production environment.)

A note about the $port variable: you might have to comment out the line declaring the $port variable to connect to your database; if you do, you will also have to comment out any reference to the $port variable in the rest of the PHP code (of course).

I have also had some difficulties connecting to the database. I thought I set up a username/password for the database, but it seems I had to set up database-specific privileges for the user I created:

  • Click the “Databases” tab.
  • Click on the test database.
  • Click the “Privileges” tab after the database info loads.
  • Click on the little guy icon (“Edit Privileges”) in the row for the user you want to use for testing.
  • In the section called “Database-specific privileges”, select your test database from the “Add privileges on the following database:” drop-down.
  • Once the page refreshes, set the necessary privileges needed for testing Flex4.


If you have any questions for a WAMP setup, I will try to answer any comments posted.

– 30 –