PHP Support for Apache 1.3 on FreeBSD
In the 2 previous tutorials, we saw how to install Apache on FreeBSD and how to get it to work with OpenSSL for encrypted connections. In this one, we'll install the uber popular server-side programming language PHP.
Start by booting up FreeBSD. Then the first thing you'll want to do is install PHP5.
Go to the PHP5 port directory.
Then do a make install clean
You'll get a screen with Options for PHP5. Take the defaults and also add the Apache module, then select OK to continue.
When the port is done you should get something like this:
Now let's go ahead and also install the PHP5 extensions. You need this to get things like MySQL support, SQLite, LDAP, sessions etc.
make install clean
You're going to get lots of options and it's up to you what to select here, however I recommend at least the defaults.
Like before, use TAB to go to 'OK' and continue.
In my case, SQLite gave me a bunch of options to select, I'm good with the defaults, so just select 'OK' to continue.
and more :
just go with the defaults, unless you know better.
If all went well, the end should look like this:
Now, let's check if Apache was configured correctly,
Go to the end of the document and add the following lines:
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
it should look like this:
then exit and save.
In case Apache is already running, restart it, type:
To try and see if PHP is working the easiest thing to do is:
And inside the file type:
should look like this:
Fire up a browser (Firefox of course!) and type the following to access our test page: http://192.168.2.101/phptest.php
You should get something like this …
If you scroll down enough, you should see the SQLite details too
Works fine! Time for coding!!