PHP5 development environment using older versions

Phillip Koebbe phillipkoebbe at gmail.com
Thu Nov 10 09:50:44 PST 2011


Greetings all. This is my first inquiry to this list. I've just been through a somewhat painful experience and was wondering if this is the norm and if so, can anything be done to make it less painful.

The gist of my problem is that when installing older versions of some ports, newer versions of dependencies are being installed rather than what the older port depended on. The specific situation involves getting a PHP development environment going on Mac OS X Lion. The staging and production servers are running Apache 2.2.14, PHP 5.3.2, and PostgreSQL 9.0, and I wanted to mimic that environment as closely as possible. As I write this, the current MacPort versions of Apache and PHP are 2.2.21 and 5.3.8, respectively.

I installed PostgreSQL 9.0 without any problems. Using the "find the revision" method, I installed Apache2 2.2.14 without any problems. When I tried doing the same "find the revision" method for PHP 5.3.2, Apache 2.2.21 was installed. I also needed php5-curl, php5-imap, and php5-postgresql, all matching 5.3.2. I started with php5-curl at 5.3.2, and PHP 5.3.8 was installed, giving me the error

Error: php5-curl 5.3.2 requires PHP 5.3.2 but you have PHP 5.3.8.
Error: Target org.macports.configure returned: incompatible PHP installation
Error: Status 1 encountered during processing.

Ultimately, I discovered that I could then activate the older version of PHP, leave the newer version of PHP installed but deactivated, and run the php5-curl install again and it would be okay. After doing that, the php5-imap install went okay because PHP 5.3.8 was already installed and deactivated. Then I tried php5-postgresql, which, being older, had a dependency on either PostgreSQL 8.2, 8.3, or 8.4, so when I tried installing it (and didn't specify any variant), PostgreSQL 8.4 was installed. I changed the Portfile on that one to use the existing 9.0 I already had installed and then it was fine.

All in all, I spent quite a few hours trying to figure all of this out. I'm wondering if this is basically how it goes with MacPorts and trying to use older versions of things. Is it possible to specify, in the Portfile, a minimum version of dependencies and avoid the installation of the newest versions of things, especially when an acceptable version of a dependency is already installed?

I apologize if this is an oft-discussed topic. I started by writing a message asking for help on how to accomplish what I needed to do, but after figuring it all out, I changed it to what it is now. In the beginning, I googled around quite a bit looking for information about setting up a PHP development environment but didn't find anything specific to using older versions of supporting libraries. The only things I found discussed PHP proper, not things like php-curl, php-imap, or php-postgresql.

Thanks for any insight.

Phillip


More information about the macports-users mailing list