Installing PAMPA for PHP Development in Windows
by scott on May.01, 2009, under PAMPA, symfony
I’ve had a ongoing problem with PHP crashing under Symfony and Doctrine in a number of environments. The crash is random and appears and disappears like acne on the face of 16-year-old boy. The best solution I’ve found is upgrading to PHP 5.3. It seems to be faster and more stable for complex OO designs than any of the 5.2 variants.
Compiling and installing PHP 5.3 on unix had it’s own set of challenges, but it was, by and large, straightforward. Once you’ve got the configuration right, it seems to compile without any major headaches.
Getting PHP 5.3 to work under windows in another story altogether. I’d given up on XAMPP and switched to WAMPSERVER with PHP 5.2.8. It installs fairly cleanly and has a nicer interface than XAMPP. However, when I went to install PHP 5.3.0RC1 under WAMPSERVER, the walls of Jerico came tumbling down. What a nightmare. My partner burned a day trying to get it work and I burned another. No love. It simply crashed Apache on startup.
There are a bazillion Wamp installations out there (see http://en.wikipedia.org/wiki/Comparison_of_WAMPs). Looking through the list, I found one called PAMPA that already has 5.3.0RC1 installed. Glory be!
Doing an initial install of PAMPA is amazingly easy. You simply unzip it and run the EXE. All of the directories are relative and it fires up like a champ. The problem is that PAMPA is designed primarily for CD/DVD installations so it shuts off anything that might conflict and runs on odd ports.
To get it to behave like a more standard installation, follow the instructions below.
Change the following in the pampa.ini file:
- Enable InnoDB if you plan to use it.
- Change the Listen=85 to Listen=80.
- Change the port=3307 to port=3306
Change this stuff in php.ini:
- Find mysqli.default_port = 3307 and change it to 3306 (the mysql port again)
- Uncomment extension=php_pdo_mysql.dll if you are using PDO
- DO NOT uncomment php_pdo.dll. PDO is build into 5.3.0. There is no external DLL.
Change this in my.ini:
- Change 3307 to 3306 (yet again)
In the depth of PhpMyAdmin:
- Find pampa\PAMPA\apache.32\htdocs\phpMyAdmin\libraries\config.default.php
- Change 3307 to 3306 (yep, again. finding this one took me hours)
To create a virtual host do this:
- Add a hosts file entry (e.g. 127.0.0.1 localhost.mywebsite)
- Add the stuff below to the top of httpd.conf
NameVirtualHost *
<VirtualHost *>
Servername localhost
</VirtualHost><VirtualHost *>
<Directory “location/of/files/for/web”>
AllowOverride All
Options Indexes
Order deny,allow
</Directory>
ServerAdmin an@email.address
DocumentRoot “location/of/files/for/web”
ServerName localhost.mywebsite
ServerAlias localhost.mywebsite
ErrorLog logs/localhost.mywebsite.log
CustomLog logs/localhost.mywebsite common
AddType application/x-httpd-php .php
</VirtualHost>
If you have already run PAMPA and make the changes, stop it and then run the task manager and verify that mysql really stopped. Often, it’s still running and may cause a conflict when you start PAMPA again. Kill it with the task manager or reboot if its running.
Changes to configuration that don’t involve MySql you can initiate by simply clicking on the P icon in the system tray and hitting restart.
Note that PAMPA does NOT install a CLI version of PHP. You’ll have to install PHP yourself if you use it from the command line (like I do).
That should do it. The nice thing about PAMPA is that you can zip it up and upload it somewhere and someone else can use the configuration by simply unzipping it and running the pampa.exe file. It’s pretty cool.