Apache and PHP make a great team for budget-conscious Web sites.
Quite often in this column, I have written about how Linux can save your business some serious money while you and your employees take advantage of its solid technical capabilities. This month, let’s focus on two other open-source technologies: Apache and PHP Hypertext Preprocessor (aka PHP). Using these two products, or commercial products based on them, is a good choice for economically powering your Web site. Apache is the Web server that powers the majority (nearly 62 percent, according to Netcraft) of the Web sites on the Internet, and PHP is a cross-platform server-side HTML-embedded scripting language that you can use to add dynamic information to Web pages.
The Apache Web server and PHP are included in most major Linux distributions. You can find out if you have Apache and PHP installed by using the software (or package) manager in the Linux graphical interface. For example, if you’re using the KDE interface, you can use the Find menu option in the program called KPackage to search for Apache and PHP. Or, you might open a terminal window (usually launched via a little icon that looks like a computer monitor) and type in php -v or apachectl status. These commands will tell you if you have Apache and PHP installed and which version numbers you have.
Apache and PHP are not just available on Linux. Apache can run on Mac OS X, Windows, Unix, and NetWare systems, while PHP is also available on Windows, Unix, Mac, and RISC systems. If needed, you can download Apache from its Web site. PHP is available from its own download site.
What to do?
Once you have Apache and PHP, what can you do with them? Well, you certainly can migrate existing static Web pages from other Web servers, such as Microsoft’s Internet Information Server (IIS) if you have concerns about security or if you’ve decided to make the switch to Linux. Even if an Internet service provider (ISP) hosts your Web site, you can request that your site be hosted on an Apache Web server.
Whether internally or externally hosted, setting up and publishing static pages to the Apache Web server is very easy to do. There are a number of free educational resources available to help you learn how to set up Apache and how to publish static Web pages on it (see table).
You can still use your favorite Web editor, such as Namo or HomeSite, to create your static pages and easily publish them to your Apache server. Most editors offer graphical access to tools that help you define where the destination Apache server is. For example, the Site Manager tool in Namo 5 lets you define your Web server name, which directory you wish to publish in, and the user name and password you use to log in to Apache.
Use PHP with Apache if you want to publish Web pages that contain dynamic content. For example, if you wanted site visitors to fill out a form when they try to reach your company, you could use PHP to take the information the user provides and take action on it, such as routing the information to an employee’s e-mail in-box. Or perhaps you’d like customers or business partners to be able to look up specific data that they are authorized to view. PHP lets you do these things and a lot more.
Just because PHP is a server-side scripting language doesn’t mean it’s only for geeks and consultants. PHP is very easy to learn, and as with Apache, there is a wealth of information to help you get started (see table). What’s more, many Web editors-like the ones I mentioned previously-include built-in support for PHP.
It is interesting to note that if you use PHP, you can produce many types of output. For example, you might process a user request for product documentation by outputting a Portable Document Format (PDF) file using PHP. Other types of output might include Flash-based videos that contain product information, or Extensible Markup Language (XML) files that you can use to exchange information in a standard way with business partners.
One of the greatest strengths of PHP is its support for a wide number of databases. With PHP you can quickly include data from a myriad of supported databases in your Web applications. Databases supported by PHP include Sybase, DB2, Oracle, SQL Server, InterBase, MySQL, PostgreSQL, and many more. The server-side scripting language also includes support for Open Database Connectivity (ODBC), so you can connect, to any database that supports this industry standard.
Aside from databases, you can use PHP to link Web applications to e-mail servers, news servers, and directory servers. You can also interconnect PHP with other Web programming languages if you are feeling adventuresome. The beauty of PHP is that it’s easy to begin using, and it’s easy to add functionality as you learn more or as you need to. Most Web editors that support PHP (and there are many that are budget-minded) provide built-in checking for errors as you type as well as a good level of detailed help in case you get stuck.
There are two new solutions that may be of interest if you decide to use Apache and PHP. The first is from Maguma AG, and it is both a server (PHP4EE) and a client-side (PHP4EE Studio) set of tools that includes Apache and PHP support. On the server side, PHP4EE includes Apache, PHP, the MySQL database, and the CVS version-control system. The latter is useful if you want to keep track of changes made to Web pages and Web applications.
PHP4EE includes a Web-based interface that you can use to manage your Web server and PHP. On the client side of things, Maguma’s PHP4EE Studio helps you include PHP in your Web pages. If you want to take a look at PHP4EE Studio, you can download the PHP4EE Studio Light version for free.
The second interesting PHP-related solution you might want to examine is Zend Technologies’ Zend Accelerator, which is available now for $980. Zend Accelerator helps you speed up Web site performance by caching PHP scripts. Although you will have to shell out a bit of cash for it, Zend Accelerator will let you serve more Web site visitors without having to invest in more hardware-which would likely cost more than this solution.
Onward and upward
If you’re willing to invest a bit of your own time or that of a savvy staffer or consultant, you can use Apache and PHP to create a very elegant Web site that meets the needs of your customers, partners, and internal business processes. Given that these two technologies are freely available, widely used, and well-documented, small- and medium-size enterprises should definitely give Apache and PHP some consideration.
A change in focus
Beginning next month, this column will be changing its focus to security products and procedures for small- and medium-size enterprises. It will be renamed Security Advisor. Securing technology assets has become a high priority item for businesses of all sizes. We’ll begin to examine what companies can do to secure networks, servers, desktops, mobile devices, and more. We’ll look at security as a process and start our exploration by looking at how businesses should secure Linux servers.
Do you have security-related questions or concerns that you’d like to see discussed in Security Advisor? If so, please write me.