April 25, 2019

Adding PHP to Apache on Linux - page 9

Supercharging Your Web Pages

  • December 23, 1999
  • By Ken Coar

With PHP installed and working, what do you do then? Well, that's really up to you�but for a couple of examples of what's possible, check out the PHP site itself and the ApacheCon 2000 site. The PHP site is totally driven by the software; as you browse through the online documentation, you can see that not only is it 'live,' meaning that you can comment on it or make suggestions for improvements, but you can also see what other people have suggested. The ApacheCon 2000 site uses PHP to display the very latest information on sessions, speakers, sponsors, and other aspects of the conference, building each page when it's requested from the data, stored in a MySQL database.

The documentation link at the PHP site is invaluable. While it doesn't give a lot of guidance on how to accomplish things, it's very complete when it comes to descriptions of the PHP functions. For more, check USENET or the PHP mailing lists.

One final trick, which is illustrated at the PHP site, is to add the 'show me the source' feature to your server. Add a line like this to your /usr/local/web/apache/conf/httpd.conf file:

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

and then soft-linka .php3 files to the same name with a .phps extension, as with

    % ln -s some-php-file.php3 some-php-file.phps

Requesting the .phps file in a Web browser will display the source of a PHP (or PHP-enabled HTML) file, nicely color-coded.

In Conclusion

If running the Apache Web server and wanting to make your Web pages more interactive, responsive, personalised or otherwise to "spice them up," PHP is an easy and excellent way to do it. The software is under constant intense scrutiny by dozens of developers, so problems are fixed quite quickly.

Got a Topic You Want Covered?

If you have a particular Apache-related topic that you'd like covered in a future article in this column, please let me know at <coar@Apache.Org>. I do read and answer my email, usually within a few hours (although a few days may pass if I'm travelling or my mail volume is way up). If I don't respond within what seems to be a reasonable amount of time, ping me again!

Most Popular LinuxPlanet Stories