apache2 activating php5

Ryan Schmidt ryandesign at macports.org
Tue Apr 24 02:13:58 PDT 2007


On Apr 24, 2007, at 03:37, Yvon Thoraval wrote:
> i've installed Apache2 by :
>
> $ sudo port install php5 +apache2 +mysql5
>
> then, i did :
>
> stop Apple's default Apache ;
> chane firewall setup following <http://edu.ca.edu/article72.html>  
> in particular,adding :
> <http://edu.ca.edu/IMG/png/coupe-feu-nouveau.png>
>
> cp httpd.conf-sample to httpd.conf
>
> edit it to my needs including :
>
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
>
> into <IfModule mime_module>
>
> did a :
>
> $ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so;sudo  
> cp /opt/local/etc/php.ini-dist /opt/local/etc/php.ini
>
> resulting in :
>
> [activating module `php5' in /opt/local/apache2/conf/httpd.conf]
>
> and finally :
>
> sudo launchctl load -w /Library/LaunchDaemons/ 
> org.macports.apache2.plist
>
> NOW, Apache2 is working well fot html and xhtml pages HOWEVER, when  
> pointing a browser to :
>
> <http://www.une-bevue.fr/PHP/info.php>
>
> the browser (either firefox or webkit) asks me what i want to do  
> with this file either
> Open it with an Application or
> Save it somewhere.
>
> I think i've missed something here but what ???

Sounds like you're almost there. Let me see what I have in my apache2  
httpd.conf, which is working fine with php5.


Near the other LoadModule directives at the top, you'll need this:

LoadModule php5_module modules/libphp5.so


You'll want to make sure your DirectoryIndex directive looks  
something like this:

<IfModule dir_module>
     DirectoryIndex index.php index.html
</IfModule>


And of course what you already put in the IfModule section:

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


Those are the only applicable occurrences of "php" in my httpd.conf  
so hopefully that would do it for you too.





More information about the macports-users mailing list