[[PageOutline]] = Setting up a development workstation = As our web sites become more complicated and more critical to our work, having a development version of your web site running in a non-public place becomes more and more important. With a development workstation, you can make and test your changes privately to ensure that they work before copying your changes to the live site. With Debian Linux, you can setup a development workstation that uses the same software used on the May First/People Link servers. Below is a tutorial for installing Debian Linux on a computer for the purposes of developing Web-based applications that use Apache, PHP, and MySQL. == Installing Debian == == Installing and configuring critical helper packages == Being able to send and receive email often part of the web application development process. {{{ 0 fidel:~# aptitude install mailx esmtp-run }}} You will then want to edit the /etc/esmtprc file, modifying the following lines: {{{ # Config file for ESMTP sendmail # The SMTP host and service (port) hostname=chavez.mayfirst.org:587 # The user name username= # The password password= #qualifydomain=@mayfirst.org #force sender=your-username@mayfirst.org #force reverse_path=your-username@mayfirst.org # Whether to use Starttls starttls=enabled }}} FIXME: I can't properly send mail with this configuration, I get the following error: {{{ Invalid peer certificate (error 20) 0 (null) jamie@mayfirst.org: 0 (null) Can't send mail: sendmail process failed with error code 70 }}} This could be related to a known [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=310968 bug in esmtp]. == Installing PHP, Apache, and MySQL == Install the required packages with: {{{ aptitude install mysql-server php5-cgi php5-cli libapache2-mod-suphp apache2-mpm-prefork php5-mysql }}} == Configuring the environment == The goal of the configuration is to make it as easy as possible to setup a new development environment for a new project. Each new project will have a unique, non-public domain name based on the name of the workstation. In this example, let's assume the workstation is named "fidel." So - a new project called mfpl would have the development domain name: mfpl.fidel (below we will edit the /etc/hosts file so that this non-public domain name will resolve to the development workstation). Apache can be configured so that it dynamically sets the document root based on the domain name. To enable that feature, create a new file called virtual-document-roots in the /etc/apache2/sites-available directory with the following contents (replace your-username with your actual username). {{{ VirtualScriptAlias /home/your-username/projects/%1/cgi-bin/ VirtualDocumentRoot /home/your-username/projects/%1/web/ }}} Next enable the vhost_alias module and the site configuration file you just created with: {{{ a2enmod vhost_alias a2ensite virtual-document-roots }}} == Steps to create a new project ==