Develop Locally With Linux, Apache, MySQL, and PHP

If you’d like to develop PHP and MySQL web apps in Linux but you’re not sure how to get started then feel free to follow along with this blog post. For the most part, installation and configuration is simple and straightforward.

Though this article is directed toward users of Mandriva Linux (my Linux distribution of choice for a desktop / web-development PC), the same instructions can apply to many of the different Linux distributions including Fedora, Red Hat Enterprise Linux, Ubuntu, and Eeebuntu. For a huge list and up-to-date news of Linux distributions available to you, take a look at the Distrowatch news site.

The easiest way to install all of the software in the LAMP stack (Linux Apache MySQL and PHP) quickly is to do it using the command-line (also known as the console). Since many new users are uncomfortable with the command-line, feel free to do all of these installations graphically using the software installer from your respective distribution.

If you’d like to proceed using the graphical installer built into Mandriva Linux, use the “Install & Remove Software” icon located in the main menu.

To install apache, mysql, and php using the Mandriva command-line, follow these instructions:

  • Open up a terminal by clicking on the Mandriva star and clicking on Terminal
  • Type “su” and press enter (this will log you in as the administrator or “root” user)
  • Enter your root password
  • Type “urpmi apache php mysql phpmyadmin nano”
  • If asked which version of apache, select a stable version to install (likely the first choice)
  • If asked which version of php, select the apache module version (not CGI or CLI)
  • If asked for permission to install extra software that is required for proper operation of the LAMP stack, select “yes” and proceed

Once the software has been installed, you should be able to open up Firefox and navigate to http://localhost . This should bring up a screen that says “It works!”, meaning that apache has been properly installed.

For reference, Mandriva Linux puts your web files in the directory /var/www/html . Straight away you may not be able to access those folders with your regular user so feel free to change the permissions of the directory recursively by using the command

chown -R yourusername:yourusername /var/www/html

Note that this operation is definitely not secure if you plan on actually hosting your website on the live Internet using this computer, but for local development you should be okay. :) To learn more about file and directory permissions in Linux, take a look at the official documentation.

Before you are able to access your databases through phpmyadmin, you will need to set your MySQL root password using the following command (being sure to change NEWPASSWORD to a password of your choice):

 mysqladmin -u root password NEWPASSWORD

Using Firefox (or whatever browser you normally use) navigate to http://localhost/phpmyadmin . Log into MySQL with your “root” user and the password you just entered into the command-line. This should give you access to your MySQL databases. For more information on how to use phpmyadmin, take a look at the official website.

Let’s create a small Hello World PHP web application by navigating to our web directory and creating it. Use the following commands to achieve this:

cd /var/www/html
nano test.php

In the editor screen that appears, enter

<?php echo "Hello World!"; ?>

Press CTRL-X and save the file before quitting. You should now be able to navigate to http://localhost/test.php and see your hello world application :)

Hopefully this has given you enough information to get you up and running. Please feel free to post comments if you’ve run into problems and hopefully I or another person in the community will be able to help you out.

Have fun with PHP on Linux!

How To Setup A Local ColdFusion Development Environment in Windows

Interested in programming in the ColdFusion language?

Setting up a ColdFusion development environment on your local computer is easy! Just follow these simple steps. This small walkthrough will enable you to develop and execute ColdFusion web applications on your Windows PC. This software is not intended for commercial use — for that, you’ll need a licensed copy.

1. Download ColdFusion Developer Edition (for free!)

You may need to sign into your Adobe.com account (or create one if you haven’t got one yet) in order to download the Developer Edition of the ColdFusion server.

Download ColdFusion Developer Edition from Adobe.com.

2. Installation Options

After downloading the software, begin installation. For all installation screens you should select all default options except in the screens shown in the images below. These settings will allow you to have the ColdFusion app server run on your computer locally.

Screen 1: Skip Product Key by selecting “Developer Edition”

Screen 2: Select “Server configuration”

Step 3:Select “Built-in web server” (This one is really important!)

3. Finish Installation

Once ColdFusion is finished, it will launch the completion script in your web browser and finish the installation. After that is complete, you will be taken to the ColdFusion Administrator screen, which will allow you to change all of your ColdFusion server settings and looks like this:

In the future you may need to change ColdFusion settings on your computer. This is the panel you will use to make those changes.

If you installed ColdFusion correctly, clicking here will take you to your ColdFusion Administrator.

Happy programming!