php5 +apache2 +mysql5 does not behave as expected

Ryan Schmidt ryandesign at
Sat Mar 17 18:47:37 PDT 2007

On Mar 17, 2007, at 08:45, Elise van Looij wrote:

> At the end of a MAMP installation (sudo port install php5 +apache2  
> +mysql5) I got the following message:
> --->  Installing php5 5.2.1_1+apache2+darwin_8+macosx+mysql5
> If this is your first install, you might want
> cd /opt/local/apache2/modules
> /opt/local/apache2/bin/apxs -a -e -n "php5"
> * copy  /opt/local/etc/php.ini-dist to  /opt/local/etc/php.ini
> --->  Activating php5 5.2.1_1+apache2+darwin_8+macosx+mysql5
> --->  Cleaning php5
> Question: what is it exactly that I might want to do? Should I copy  
> those lines from cd ... ini into my terminal? As one line, three  
> lines?

You can copy and paste the two lines into your Terminal exactly as  
they appear:

cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5"

This should activate the php5 module.

It's further suggesting that you may want to copy php.ini-dist to  
php.ini in /opt/local/etc, as a start for your PHP configuration.

> Does this have anything to do with the fact that the installation  
> did not result in a proper httpd.conf, as I expected, but in a file  
> called httpd.conf.sample which, among other things, has no  
> LoadModule for php5?

The apache2 port creates the httpd.conf.sample. You can copy this to  
httpd.conf as a basis for your Apache configuration.

If it doesn't contain a LoadModule line for the php5 port after you  
run the apxs command above, then add one that reads like this:

LoadModule php5_module modules/

You'll probably also want this, if you don't have it already:

<IfModule dir_module>
	DirectoryIndex index.php index.html

And this, at the end of the <IfModule mime_module> section:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

That should be all you need.

The instructions printed by the php5 port at the end may need to be  
updated. Patches to the portfile are welcome.

More information about the macports-users mailing list