I guess I am spoiled with Redhat’s integration of all these packages where you simply install and away you go. Macports isn’t quite a polite in this regard. The default config files are incomplete and not enabled when it is installed.
So I have had to do some massaging to get php working.
The file /opt/local/apache2/conf/extra/mod_php.conf
is missing some configuration parameters. I’ve changed mine to look like this:
<IfModule mod_php5.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps AddHandler php5-script .php AddType text/html .php DirectoryIndex index.php </IfModule>
I specifically had to add the handler and also load the module. Then in the /opt/local/apache2/conf/httpd.conf
file, I had to add the line: Include conf/extra/mod_php.conf
as there wasn’t even a commented out line that would include this module. Also in the /opt/local/apache2/conf/httpd.conf
file, also need to add the line LoadModule php5_module modules/libphp5.so
so that the php library is loaded into Apache.
A graceful on the server:
sudo /opt/local/apache2/bin/apachtctl graceful
and away we went.
Damien.
Addendum
Turns out that a message is printed at completion of the install, which was not apparent to me because I used a GUI to do the installation. The message states:
If this is your first install, you need to activate PHP in your web server.
To enable PHP in Apache, run
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n “php5” libphp5.so
A useful tip I highlighted in a previous post helps to find this sort of information after installation. This command simply adds a LoadModule option to the main httpd.conf file, but does not add the other configuration options above. So you still need to make the above changes.
Good to see that the educational developers are focusing on learning and teaching issues. 😉
I’m sure if you worked in IT and were using the MOE, you wouldn’t be having these problems.
I seem to remember a former colleague banging out PHP code (BIM) in the name of learning & teaching not so long ago. I assume you had to make Apache & PHP play nice to achieve that. 😉
Sure, there would be no problems with a “managed” operating environments because they are so flexible. 🙂
Damo.