So MacPorts is the most painless way of installing stuff on my machine. But I want some custom options on my php5 install. How do I do this?

With a downloaded version of php, I would do this: ./php_folder/configure --with-config-file-scan-dir=/etc/php.d

With MacPorts I install it with this: sudo port install php5 +apache2 +mysql5 +pear

But I want to do something like this... sudo port install php5 +apache2 +mysql5 +pear --with-config-file-scan-dir=/etc/php.d

I just have no idea how to do it. Documentation says I can create a portfile but that looks a bit overkill for what I want to do.


You can try go to /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/ subfolder and open in pico or vim editor Portfile located in each product folder you want to install.

For example - /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/php5/Portfile

In this file you should go to line with text configure.args and add configure options you need.

Hope it helps.


Customizing the Portfile is the right way to go, as suggested by Dmitry. But instead of messing with the official portfile synced from rsync.macports.org, it might be a better idea to create a local portfile repository and put the customized version of the portfile there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy