New to Drupal… Lets get started!

As I told in the previous post on this subject, the best way to learn Drupal is installing and playing around with it!

But before we start, how about creating an account at drupal.org? I think that’s a pretty good idea!

Let’s go then…

Installing Drupal (version 6.6 at posting time)

In won’t go into details about how to install Drupal, all you need is PHP (I’m with PHP 5, MySQL or SQLite, and of course, a web-server). If you are thinking about running Drupal in localhost you’ll be more than happy with the amount of videos and tutorials on how to do this installation (WAMP on a windows Machine, MAMP on a Mac and LAMP if you’re with Linux. (never mind if all the links are leading you to the Lullabot website… It’s just that I like them a lot 😉 )

In my case I have Drupal running with WAMP on my local machine.

Drupal Installed! – Now for some headaches.

Headache #1: Setting up clean URLs

First thing to do is to enable mod_rewrite on your Apache installation, the second is to allow override in your Drupal directory. Then… everything should be running. Well, not always. If you’re using an alias (or a subdirectory in your www) you must also change the rewrite base. Here are the examples from my instalation:

I setup Drupal folder outside www on a folder named drupal. Next step was to create an alias… Here is my alias code:

Alias /drupal "c:/wamp/drupal/"
<Directory "c:/wamp/drupal/">
   Options Indexes FollowSymLinks
   AllowOverride all
   Order allow,deny
   Allow from all
</Directory>

The next step is to change my rewrite base to /drupal (which is my alias name) . This in done in the .htaccess file that you’ll find in your drupal folder. This is a snipset of what you’ll find:

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal (MY CASE)
  RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

Urrayy – clean URLs are ON 🙂

Headache #2: Performance on the site administration area

Another headache was the poor performance I was getting on the sites administration area! After some readind I found that most of this was due to WAMP itself… One solution would be to play around WAMP configuration to improve it’s performance… Maybe on another ocasion!!

Performance break down occurs specially when you are trying to enable and disable modules or setting up permissions (permissions it self would give a great post… On another day)! So, the best you can do is to enable only the (contributed) modules you’ll be using… Even more.. don’t keep installations of the modules you’re not using (use the uninstall feature when available and delete from /sites/all/modules). Why? Because all the modules in this folder are loaded by Drupal. The less modules you have the less querys and the less hooks are necessary!

Headache #3: MySQL timeouts

The main cause for this headache was headache number one… Poor performance! When enabling modules or setting permissions I was getting this pretty ugly blank screen with a timeout message! The soluition for this is pretty simple: Just add the following code to your settings.php (sites/default/settings.php):

ini_set('max_execution_time', 0);

Where? I would recommend the bottom of the page!

Headache #4: Setting up cron

What would be an easy task on Linux could become I real pain in Windows. In fact windows doesn’t know what cron tasks are. A solution would be to setup a scheduled task. The other solution is to install the Poormanscron module. Basically what this module does is to check (after each page load) if the last cron run was more than a pre defined (configurable) period of time!

If you don’t know, or are not allowed to setup cron tasks I would definitly say that this is a must have module! Drupal really needs cron to run very often, one good example is the (core) Aggregator module, try to setup an external feed widthout running the cron job :p

Enought of headaches!

I really hope this was helpfull!

Advertisements

2 Responses to “New to Drupal… Lets get started!”


  1. 1 Michael J March 16, 2009 at 3:16 pm

    I need some help. I am using a friends linux box for development and my directory is /users/dj/public_html/cms for the drupal install and this will get me there: http://db.sphurism.net/~dj/cms I tried making the rewrite base /~dj/cms in the .htaccess file and I got a 500 internal server error when I go to http://db.sphurism.net/~dj/cms.

    When I delete the .htaccess file — I get no errors.

  2. 2 Lucas Pereira March 16, 2009 at 3:37 pm

    “When I delete the .htaccess file — I get no errors”, if it works by deleting the .htaccess file maybe this is because your webserver doesn’t have .htaccess enabled! Take a look a this: http://httpd.apache.org/docs/2.0/howto/htaccess.html

    Hope this is somehow usefull!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: