• Login
  • Register
  • Account
  • About 'corePHP'
  • Portfolio
  • SiteMap

Joomla! Development, Professional Joomla! Templates, Components, Extensions and Plugins — 'corePHP'

Professional website development and design services

  • Home
  • Joomla! Products
    • Components
      • Community ACL
      • Droomla
      • jomCalendar
      • jomLike
      • JPhoto
      • Mortgage Calculators
      • WordPress
    • Plugins
      • Amazon Pack
      • Automated CSS3 Generator
      • Chimp Your Joomla!
      • JAutosearch
      • jomCDN
      • jomDefender
      • VirtueMart Age Restriction Plugin
    • jomSocial Add-ons
      • jomGive
    • Dreamweaver
      • Template Basics
    • JPhoto Add-ons
      • JPhoto Slideshow
    • cACL Add-ons
      • DOCman Plugin
    • CB Plugins
      • DOCman Downloads
    • Modules
      • YouTube Module
  • Templates
    • Joomla Themes
  • Services
    • Joomla! Services
      • Joomla! Install and Upgrading Services
      • Joomla! Website Design/Maintenance
      • Joomla! Custom Development
      • Joomla! Component Development
    • Template Services
      • Joomla! Template Conversion
      • Joomla! Template Design
      • PSD Template Design
    • Print Service
      • Print Design
  • Resources
    • Affiliate Club
    • Search Engine Submissions
    • 'corePHP' Partners
  • Blog
  • Support
    • Submit Ticket
    • Community Forums
  • Contact Us

Search the Blog

  • Categories

    • 'corePHP'
    • 'corePHP' Products
    • Accessibility
    • Dreamweaver
    • Expos
    • Flash
    • Graphics
    • Javascript
    • Joomla
    • Marketing
    • Mobile
    • Operating System
    • Other
    • PHP
    • Print
    • Public News Articles
    • Recommended Software
    • security
    • Templates
    • Tools
    • Uncategorized
    • XHTML+CSS
  • Pages

    • Chicago ’09
    • Denver Expo / Fun
  • Archives

    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • May 2008
    • February 2008
    • January 2008
    • September 2007
    • April 2007
    • February 2007
    • December 2006
    • September 2006
    • August 2006
    • July 2006
    • June 2006
    • May 2006

Tag Cloud

'corePHP'  Android  app  Battle Creek  bugs  Christmas  CMS Expo  community  Community Acl  css  discount  fix  holidays  html  ie  ie6  iOS  jomCDN  jomMobile  jomsocial  Joomla  Joomla! 1.5  Joomla! 1.6  Joomla Chicago  joomla extensions  joomla products  joomla sale  JPhoto  mobile  new products  new release  PHP  plugins  products  sale  security  small business  snippets  Steven Pignataro  success  template  tips  WordPress  WordPress MU  youtube

'corePHP' Blog


Keep up to date on what's happening at 'corePHP'

« Lifestream for Joomla! from JoomlaShack
The if() Control Structure »

Setting up a Joomla! Development Environment

If you are new to web development and are interested in using Joomla!, you may have used Google to try and find info to help you out. You may have done a search for “joomla development” or “joomla development tools” and got Setting up your workstation for Joomla! development as one of the results. This explains how to set up XAMPP and Eclipse on Windows, Linux and OS X. Now this document has some extremely useful information for people looking to get started. They even state that there are many possible configurations of environments for developing for Joomla!. I’m going to talk about how I have my environment setup for web development.

My workstation is setup with Ubuntu 10.04 running lighttpd/PHP 5.3/MySQL 5.1. I’m not going to go into details on how to install Ubuntu because there are already a few articles and blog posts out there explaining how to do this. Lighttpd is a web server like apache which aims to be fast and efficient with your system resources. You can use Apache if you like but I’m going to go over how I have lighttpd/PHP/MySQL set up.

Since I am using Ubuntu, I can just install everything needed from the Ubuntu repositories. All the commands below require you to open up a terminal and type in the command or copy & paste for them to run.

The following command will install lighttpd, PHP 5 with some extra packages, and MySQL.

$ sudo apt-get install lighttpd php5 php-pear php5-cgi php5-xdebug php5-curl \
php5-gd php5-mcrypt mysql-client mysql-server

During the install you will be prompted to insert a MySQL root password. This password is not the root password to your computer.

Note that you can see what other extra PHP packages are available by doing the following command in a terminal window :

$ sudo apt-cache search php5

Now that everything is installed, let’s begin setting it up.

By default, lighttpd runs under its own user and serves documents out of /var/www. While I’m working I don’t really like to leave my home directory. I also don’t want to deal with a problem because of permissions. So I prefer to have the web server running as my user and the web root sitting in my home directory. Now we will go over how to accomplish this.

You can name any of the directories below the way you want and organize them how you want. You just need to make sure you put the correct paths for the directories you create in the configuration file.

On my system, I put everything under ~/work (the “~” is a shortcut to the full path of your home directory). First, we are going to create the web root directory where all the code will reside.

$ mkdir -p ~/work/webhome

The -p flag of mkdir makes sure all parent directories are created. If none of the directories are there, it will first create the work directory, then the webhome directory.

We need to create the log directory, upload directory, and compress directory (if you enable mod_compress) into the home directory. I do this so I don’t have to mess around with changing a bunch of permissions.

$ mkdir -p ~/work/lighttpd/upload
$ mkdir -p ~/work/lighttpd/log
$ mkdir -p ~/work/lighttpd/compress

Now it’s time to change the paths and setup lighttpd. You can use whatever editor you like -  just replace vim below with the name of the editor you want to use.

$ sudo vim /etc/lighttpd/lighttpd.conf

We need to first make sure some modules are enabled for lighttpd to work. By default everything we need is there but mod_fastcgi, which will allow lighttpd to parse PHP files. Below is the server.modules section of my lighttpd.conf file.

server.modules              = (
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_compress",
            "mod_fastcgi",  # this needs to be added as it is not there by default
#           "mod_rewrite",
#           "mod_redirect",
#           "mod_evhost",
#           "mod_usertrack",
#           "mod_rrdtool",
#           "mod_webdav",
#           "mod_expire",
#           "mod_flv_streaming",
#           "mod_evasive"
)

Now we change the following options in the lighttpd.conf file. Make sure you use the full path of the folders you created above along with the user:group you want the server to run as. Below are the options that are changed in my lighttpd.conf file.

server.document-root = "/home/dustin/work/webhome"

server.upload-dirs = ( "/home/dustin/work/lighttpd/upload" )

server.errorlog = "/home/dustin/work/lighttpd/log/error.log"

accesslog.filename = "/home/dustin/work/lighttpd/log/access.log"

# size in kbytes - this is optional if you want to be able to upload big files
server.max-request-size = 20000

server.username = "dustin"

server.groupname = "dustin"

# if you have mod_compress enabled
compress.cache-dir = "/home/dustin/work/lighttpd/compress/"

Once done, save and close the file.

We enabled the module for fastcgi in the lighttpd configuration file. We need to enable the configuration for fastcgi. The following command accomplishes that.

$ sudo lighty-enable-mod fastcgi

Now we need to change the /etc/init.d/lighttpd file which controls starting/stopping/restarting of lighttpd. Since we changed the user:group that lighttpd runs as, and its init script makes sure that the directory /var/run/lighttpd is there with the correct user:group, we need to change the user and group.

Open /etc/init.d/lighttpd with your editor from the command line.

$ sudo vim /etc/init.d/lighttpd

We need to change the following line. Make sure you change www-data:www-data to the user:group you set in the /etc/lighttpd/lighttpd.conf file. Below is the original line and how I changed it:

chown www-data:www-data /var/run/lighttpd

changed to:

chown dustin:dustin /var/run/lighttpd

Once done, save and close the file.

There is one more change we need to make so paths work correctly in PHP. We need to open /etc/php5/cgi/php.ini and make sure cgi.fix_pathinfo=1 is uncommented. So open /etc/php/cgi/php.ini in your favorite editor.

$ sudo vim /etc/php5/cgi/php.ini

Search for cgi.fix_pathinfo=1 which is on line 842 on my machine and uncomment it by removing the ; at the beginning of the line.

Now lets restart lighttpd for all the changes to take affect.

$ sudo /etc/init.d/lighttpd restart

You should now be able to browse to http://localhost/ and see an empty directory listing. Now you can create different directories with installs of Joomla! or whatever you please and access them via http://localhost/directory_name or http://localhost/file_name.php.

One last thing we need to do is create a MySQL user to use. Now since this is more than likely your development machine using, the MySQL root user isn’t a huge problem. Just don’t ever use the MySQL root user for your scripts on a production server. This can lead to a lot of problems.

To create a new user:

$ mysql -u root -p
# you will be prompted for the password you entered during install
mysql> CREATE USER 'USER_NAME_YOU_WANT'@'localhost' identified by 'SOME_PASS_YOU_WANT';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'USER_NAME_YOU_WANT'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

Reference: MySQL Adding Users

At the very least, I hope this post gave you some ideas for playing around and setting up a development environment that is comfortable for you.

Tags: Joomla, Lighttpd, Linux, PHP

This entry was posted on Wednesday, August 18th, 2010 at 11:14 am by Dustin Clute and is filed under Joomla. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Setting up a Joomla! Development Environment”

  1. Video Marketing Site says:
    December 23, 2010 at 2:58 pm

    Thanks, joomla is great. I always use it.

  2. Nick Richards says:
    March 17, 2011 at 2:22 pm

    Hello

    We set up a server with these instructions exactly.

    We copy a PHP file to the working directory, however when we try to run the PHP file, it always says 403 Forbidden. We have changed and verified set permissions for the PHP file and made it executable etc, but to no avail.

    Otherwise, we are all set up and ready to go, but at the moment we just can’t use the server we have set up.

    Any suggestions?

    info at cgeeks dot co dot uk

    Thanks,

    Nick Richards
    Computer Geeks

  3. hacking says:
    April 11, 2012 at 2:50 am

    Some screen shots would have been very helpful.

Leave a Reply

Click here to cancel reply.

User Information

Message


'corePHP' Blog is proudly powered by WordPress. Joomla! extensions by 'corePHP'
Entries (RSS) and Comments (RSS).

'corePHP' at a Glance

  • About 'corePHP'
  • Portfolio
  • SiteMap

Joomla! Products

  • Joomla! Components
  • Joomla! Modules
  • Joomla! Plugins
  • Dreamweaver Snippets

Services

  • Joomla! Install and Upgrading Services
  • Joomla! Website Design/Maintenance
  • Joomla! Custom Development
  • Joomla! Component Development
  • Joomla! Template Conversion
  • Joomla! Template Design
  • PSD Template Design
  • Print Design

Resources

  • Search Engine Submissions
  • 'corePHP' Partners
  • Blog

Contact

  • Contact Us
  • Support Desk
  • Forums

Policy Statement

  • Terms of Service
  • Refund Policy
  • Cancel Subscription

Contact Us

(269) 979-5582
62 East Michigan Ave.
Suite 202
Battle Creek, MI 49017

Join Our Mailing List

Affiliate Club
Become an affiliate!

©2011 'corePHP' All Rights Reserved – Designed by 'corePHP'

  • Twitter
  • Plurk
  • Digg It
  • Facebook
  • LinkedIN
  • RSS