Web DevCenter    
 Published on Web DevCenter (http://www.oreillynet.com/javascript/)
 See this if you're having trouble printing code examples

GoLive 6: Adobe's Open Source Embrace

by Glenn Fleishman

Author's Note -- Before GoLive 6 shipped, I would have tried to dissuade anyone but an already experienced Unix administrator or someone who needed to become one as part of a job from trying to self-install all the components needed to run MySQL, PHP, Apache, and JSP on a Mac OS X machine or under Windows XP or 2000. If you're already serving pages that need these elements and want to migrate them to a desktop server, or want to start serving content that requires these elements, the GoLive Preconfigured Servers substantially lower the bar.

In this article I'll show you where these components are located in the GoLive 6 shrink-wrap, and then once you have a handle on these tools, I'll show you how to upgrade them the good, old-fashioned, open source way.

GoLive 6 Breaks From Tradition

Adobe has never expressed close feelings for either open-source software or the Unix and Linux platforms. As Linux has risen in popularity and open source has increased in quality and availability, Adobe provided only sporadic and incomplete support. Photoshop under Red Hat? Nope. But Acrobat Reader for certain Unix flavors? Sure.

GoLive 6 marks a decided change in attitude from Adobe. In the interests of a competitive product and a complete server feature set, the company leapt into bed with Apache, Tomcat (a JSP server), MySQL, and PHP under both the Darwin environment of Mac OS X and the modern NT-style architecture of Windows XP and 2000.

As Derrick Story noted in the first article of this series, GoLive emerged from the graphic design world in which the program started as a WYSIWYG page layout tool. Over time, it evolved into a full-featured editor with support for JavaScript, Cascading Style Sheets, and Dynamic HTML, working alongside a drag-and-drop site management system.

At the same time as GoLive, Inc. (and later Adobe-developed GoLive), Macromedia pushed and pulled its own page and site tool, Dreamweaver. As GoLive became more graphically intense and expanded its reach into directly editing different kinds of media (QuickTime, images, vector art) and integrating with other Adobe graphic tools (Photoshop, Illustrator, ImageReady, LiveMotion), Dreamweaver kept climbing up the code ladder, including more and more built-in or add-on support for code development that worked alongside page and site creation.

Dreamweaver UltraDev, for instance, was a powerful package that supports authoring ASP, JSP, and ColdFusion. It integrates many kinds of databases and database conduits with page layout tools, and provides end-to-end support in the case of JSP (with their JRun server) and ColdFusion (part of their Allaire merger) for design to code to database to server testing and development. (Dreamweaver MX expands this to incorporate UltraDev, and to work with and create Web services and Web applications using JavaServer Pages, ColdFusion, SOAP, and .Net.)

GoLive lagged on the code side, and its initial foray into database integration, called Dynamic Link, only worked with ASP servers running ADO DB conduits or Microsoft Access databases. It was frustrating to configure and use, and I only know a handful of users who had the right combination of server and savvy to build a functioning system.

Adobe wisely jettisoned Dynamic Link, replacing it with Dynamic Content. The change wasn't cosmetic, but reflects instead a significant improvement in features, flexibility, and troubleshooting. GoLive 6 supports ASP, JSP, and the Internet favorite PHP for database integration of content. It also ships with a full set of preconfigured servers for both Mac OS X and the Windows XP/2000 environments. The preconfigured servers include Apache 1.3.22 with PHP 4.1.2 precompiled in; Tomcat 3.2.2, a JSP server; and MySQL 3.23.47.

For many users, the preconfigured servers allow them to suddenly tap the potential of database integration with a Web site without the vast ramp up in knowledge typically required to compile and configure server software. This package is simple to get started with, but, as with any commercial release, hard-won tips help smooth the process.

Installing GoLive 6 Preconfigured Servers

The preconfigured servers ship on a disk bound into the Adobe Web Workgroup Server manual. (More on AWWS later: it's a JSP-based WebDAV server that supports versioning via a GoLive interface.) Once installed, a set of test scripts allows some configuration and displays example results and projects.

Installing it is typically a snap. The installation system is slightly different under Windows 2000/XP and Mac OS X, but both involve a package-style graphical installer, which includes screens of instructions. The Apache/PHP and JSP servers are in the Dynamic Content folder. This single installer puts all of the software in the right place.

Web Database Applications with PHP, and MySQL

Related Reading

Web Database Applications with PHP, and MySQL
By Hugh E. Williams, David Lane

The installer allows you to set non-default ports for any of the associated applications. PHP is compiled as part of Apache, so Apache calls it internally. Tomcat is a JSP server that Apache connects to. MySQL is a server that any scripting language can interact with through the appropriate conduit or interface.

MySQL's installer is found in the Extras folder, which also has the JDBC driver (the Java Database Connectivity or database conduit) for MySQL.

To install MySQL, you need to follow the instructions in the Readme file, which include copying the install script to the local hard drive, launching Terminal, and creating a new user account. The instructions are actually quite clear and more than adequate.

MySQL, as installed, still requires a command-line entry to set the root password for the server. The install script offers up a reminder to run these two commands:

./bin/mysqladmin -u root -p password 'new-password'
./bin/mysqladmin -u root -h localhost -p password 'new-password'

The "localhost" item is literally "localhost": if your system identifies itself by a host name, "localhost" isn't the right value. MySQL is very particular.

When you're choosing MySQL passwords, keep in mind a later issue we'll cover: MySQL passwords are stored in the clear in well-known locations as part of the GoLive Dynamic Content system. The passwords are enveloped in a script file that prohibits access. But nonetheless, they're in the clear on your server. In my case, I opted to create a special, limited permission account that wouldn't wreak havoc if my server were compromised. Adobe should take note: this is a giant, gaping security error.

The iconv library is also in the Extras folder; it must be installed into your PHP directory following the instructions in the same folder for PHP to work. This appears to be a licensing issue.

The installation process also creates server start, stop, and restart scripts for all servers and individual servers in the package.

Both the Apache/PHP and JSP servers can be used as actual production systems by editing the configuration file. The installer creates shortcuts for opening and editing the configuration files associated with the two servers, or you can just use Terminal to edit the files with vi or another text editor.

Many GoLive users, even sophisticated ones, may balk at the command-line SQL sequences that MySQL (and other databases) require. A colleague pointed me to the superb phpMyAdmin set of scripts that put a Web front-end onto MySQL administration. Download the source code from phpmyadmin.sourceforge.com.

Problems With Preconfigured Releases

The downside of Adobe's prefab offerings is that you're reliant on them to update the various components. For instance, in a remarkable burst of releases just after Adobe shipped GoLive 6.0, a major PHP vulnerability was discovered and fixed, and the Apache Software Foundation released PHP 4.2.0 and Apache 2.0.35 (the first post-beta 2.0 release).

The question remains whether Adobe will hop on and at least offer a patch script to repair the PHP vulnerability; and whether when PHP matures into full support for Apache 2.0 -- it's listed as experimental in the current release -- they'll also offer up revised servers.

Related Reading

Apache Pocket Ref
By Andrew Ford

In the meantime, patching the PHP vulnerability is simple. Find the php.ini configuration file, which for Adobe's installation is in the ./GoLive Preconfigured Servers/php_server/apache directory. Comment out the line that reads file_uploads = On (line 373 in the version I have) by adding a semicolon at the start of the line. Restart the Apache servers.

Installing Your Own

You can go a step further and bypass their installation altogether by collecting and installing a full Apache, PHP, and JSP setup. I'm not a JSP expert, so I leave that one to the ONJava.com site, which has more information about Tomcat and its relative, Jakarta: http://www.onjava.com/onjava/jsp_servlets/. But I can offer insight into configuring Apache with all the bells and whistles.

Start with Apache 1.3.23, the last 1.3 release (httpd.apache.org). Although 2.0 is now the recommended version, you can't rely on PHP support, as noted above. If you need SSL support, retrieve OpenSSL (www.openssl.org) and mod_ssl (www.modssl.org). From www.php.net, retrieve 4.2.0.

If you want to handle XML in various forms through Apache and PHP, you'll need Sablotron. GoLive's Dynamic Content allows you to retrieve information from XML, including using XSL transformations on the XML data. To install Sablotron you may also need to download a whole set of XML libraries. Consult XML.com for more on that aspect of installation and configuration.

MySQL can be downloaded in various forms, including ready-to-go packages, from MySQL.com.

If you need SSL support, which I typically include, visit www.modssl.org and www.openssl.org to retrieve the necessary pieces for SSL inside Apache. You don't need external certificates to use SSL, although they can be useful.

Now you can proceed to assemble the distributions.

  1. Gunzip and untar these files in a temporary construction directory.
  2. Change to the Apache directory and run ./configure; this sets Apache up to handle the PHP installation.
  3. Jump up a level and change to the OpenSSL directory. Run its configuration process; see its Readme and Install documentation. Skip this step to omit SSL support.
  4. Change to the Sablotron directory, and configure with this command: ./configure --disable-javascript Then compile and install it. (There are options to include JavaScript libraries from Netscape, but I was unable to get these to work.)
  5. Change to the PHP directory, and enter the following, making changes to the newest version numbers if newer versions are available. Remove the openssl line and the \ on the previous line if you're not including SSL support. Omit the lines --enable-xslt and --with-xslt-sablot to exclude XML data source processing.
    ./configure \
    	--with-mysql \
    	--with-apache=../apache_1.3.23 \
    	--with-config-file-path=/etc \
    	--enable-magic-quotes \
    	--enable-debugger \
    	--enable-track-vars \
    	--with-db3=/usr/local/BerkeleyDB.3.1 \
    	--with-openssl=../openssl-0.9.6c/ \
    	--enable-xslt \
  6. Change back to your construction directory and install the file below as apache-configure (making changes for version numbers as needed). Remove the openssl line and the \ on the previous line if you're not including SSL support.
    cd mod_ssl-2.8.7-1.3.23
    ./configure \
    	 --prefix=/usr/apache13 \
    	 --verbose \
    	 --enable-module=expires \
    	 --enable-module=usertrack \
    	 --enable-module=rewrite \
    	 --enable-module=status \
    	 --enable-module=proxy \
    	 --enable-module=so \
    	 --activate-module=src/modules/php4/libphp4.a \
    	 --with-apache=../apache_1.3.23 \	 
    cd ..
    cd apache_1.3.23
    make install
  7. Run the program while in the construction directory:
    sh ./apache-configure
    The script compiles and installs the software.
  8. Set up the configuration files. Apache includes documentation and sample files in the path /usr/apache13/conf (if you installed using the above settings). Make sure and use the directives required to pass PHP code on to the PHP processor.

Related Reading

PHP Pocket Reference
By Rasmus Lerdorf

PHP has its documentation online and you can edit the /etc/php.ini file to meet the requirements of GoLive, which will tell you the settings you need to change as appropriate.

For more on configuring Apache and PHP, visit the subsection of the ONLamp.com site devoted to it.

Sweat of the Brow

It may appear to be much more work than you're ready to take on to install these servers. But, in fact, it's a one-time exercise. After you've installed and configured the servers, GoLive's humming engine can leap to life and you should practically never have to even touch the server configuration again. Until, of course, the inevitable newer releases.

Glenn Fleishman is a freelance technology journalist contributing regularly to The New York Times, The Seattle Times, Macworld magazine, and InfoWorld. He maintains a wireless weblog at wifinetnews.com.

Return to the Web Development DevCenter.

Copyright © 2009 O'Reilly Media, Inc.