Category Archives: Drupal

Drupal development tools

Last updated May 24, 2013. Created by mike stewart on May 29, 2007.
Edited by irohit786radimklaskacweagansjacobbednarzLog in to edit this page.

Use these development tools to help you create Drupal sites faster and with less effort. If you have a favorite Drupal tool that is not listed, make sure you’ve checked every section of this document.

Still can’t find your fav? Please add it using the format as other listings, similar to:
Toolname (Free/Commercial. FOSS/Proprietary. OS Platforms.) – Description.

Tools for Your Browser

Tools for Editing Text & Code

In the world of pure Linux/Unix, the most popular editors are the intimidating but powerful Emacs and Vi. Devotees have long argued the merits of which is better. You’ll want a cheat sheet to learn either, but serious users find that Emacs and Vi allow fast, touch-typed editing that’s quicker than using a mouse-based desktop application.

  • Emacs (Free. Open source. Runs on Linux, Mac, Windows and others.) (Details aboutconfiguring Emacs for Drupal)
  • VIM (Free. Open source. Linux, Mac, Windows and others.) — Vim is an advanced text editor based on vi, but more powerful. The learning curve is reasonably steep and the interface can be confusing at first, but this is soon rewarded with greater editing efficiency. (Details about configuring VIM for Drupal and documentation for the Vimrc project.)

Other Editors

  • BBEdit (Commercial. Proprietary. Mac only.) Check out BBEdit Clippings for Drupal 7
  • Bluefish Editor (Free. Open Source. POSIX > Linux. Mac. Windows. Fast, lean multi syntax WYSIWYN editor with a focus on HTML/CSS/Javascript – GTK+ based). The Windows version can be found at
  • Dreamweaver (Commercial. Proprietary. Mac and Windows.) – A WYSIWYG HTML/XHTML, CSS, PHP, XSL/T editor, and there’s a free Drupal API extension for Dreamweaver.
  • gPHPEdit (Free. Open source. Runs on Linux)
  • jEdit (Free. Open source. Runs on Linux, Mac, Windows and others. Java based.)
  • Komodo Edit (Free. Open source. Runs on Linux, Mac and Windows. Configuration guideavailable.)
  • Notepad++ (Free. Open Source. Windows only.) – A light-weight notepad replacement with tabbing and syntax highlighting.
  • Smultron (Commercial. Proprietary. Mac only.)
  • TextMate (Commercial. Proprietary. Mac only although a Windows clone exists) – A couple of Drupal specific bundles are available, the PHP Drupal bundle which has the most features and another by Steven Wittens which allows tab completion of function signatures – both can exist without conflict. A lot of the power of TextMate is in its bundle system and it has built-in support for diff which speeds up the rolling and applying of patches and many more.
  • TextWrangler (Free. Proprietary. Mac only.) — Lets you read and save via FTP/SFTP, and supports grep and Show Changes (diff).
  • Coda (Proprietary. Mac only.) – Editor for web pages (HTML, CSS) with preview and FTP capabilities; has a Drupal plugin.
  • Sublime Text 2 – Win, Mac OSX, and Linux. A very clean and user friendly code editor. Interface is smooth. And compatible with many TextMate bundles. (Proprietary. Has full-featured trial available with no time limit.)

Integrated Development Environments (IDE)

IDE’s expand on the ability of a simple text editor. Here is a list of IDE’s that work well with PHP and Drupal.
Note: There is also a Drupal IDE group dedicated to setting up an IDE for Drupal development for starter tips, and ongoing interactive discussions.

  • Eclipse (Free. Open source. Linux, Mac, Windows and others. Java based.) Probably the most popular open source IDE. Eclipse requires plugins in order to develop PHP. The PHP editing plugins for Eclipse are listed below by popularity:
      • PHP Development Tools (PDT) from The Eclipse Foundation. This is generally considered the new version of PHPEclipse. Open source and community supported. PDT provides a PHP Development Tools framework for the Eclipse platform.
      • PHP Development Tools (PDT) from Zend. Same as above but from Zend. Another commercially supported PHP development using Eclipse from version 3.3+.
      • PHPEclipse project is the original PHP development plugin for Eclipse. This is considered the previous version. The new version is called PHP Development Tools (PDT). See above.

    Notes about Eclipse:

  • Aptana (Free. Open source, though some features, notably SFTP support, require a commercial license. Linux, Mac, Windows and others. Java based.) — A full-featured Web Development IDE. A package based on the Eclipse environment that comes with the essentials right out of the box (PHP highlighting, ftp/sftp, code browser, etc).
  • Netbeans cross-platform IDE with full PHP and debugging support. (Free. Open Source. Linux. Mac. Win. Solaris). Supported by Sun Microsystems (Oracle).
    • Firefox extension easy Xdebug makes debugging easy with Netbeans.
    • Very nice code completion
    • Automatic text highlighting for tons of languages
    • In context HTML, CSS, PHP reference makes it easy to find help on code syntax without leaving the file you are working on.
    • Instructions for configuring Netbeans for Drupal
    • Two Netbeans plugins are available to aid Drupal developers: NBDrupalSupport andNBDrupalDevel
  • Bluefish Editor (Free. Open Source. Linux. Mac. Fast Lean multi syntax WYSIWYN editor – GTK+ based). A lightweight, fast, multi-syntax IDE that supports projects, multiple documents, ftp/webDAV/sftp/http/https/samba, user custom integration with many programs like make, lint, weblint, xmllint, tidy, javac, more…, multi-language translations, etc. Just an awesome text editor on steroids.
  • Emacs (Free. Open source. Runs on Linux, Mac, Windows and others.) Mentioned above as “text editor” but also may be used as fully functional IDE for Drupal and PHP. Some of Emacs IDE functions appliable for PHP and Drupal are: syntax highlighting for PHP/JS/CSS/HTML, integration with VCSs (include git), debugger, on-type syntax checking for PHP/JS/CSS, Texmate-like code templates. (See details about configuring Emacs for PHP and Drupal and a project “Emacs IDE for Drupal”)
  • Quanta Plus (Free. Open Source. Linux – Part of the KDE environment).
  • Geany (Free. Open Source. POSIX > GTk+. Linux. Mac. Windows. Fast lean multi syntax – GTK+ based).
  • Komodo IDE (Commercial. Proprietary. Linux, Mac and Windows.) Drupal Configuration notes available and Module building extension with node and user code intelligence
  • Zend Studio (Commercial. Proprietary. Linux, Mac and others. Java based.)
  • PhpEd (Commercial. Proprietary. Windows, Linux.)
  • CodeLobster (Commercial and free versions. Proprietary. Windows only.) IDE with PHP/HTML/CSS/JavaScript highlighting, advanced PHP/HTML/CSS/JavaScript autocomplete, PHP debugger, SQL autocomplete, context and dynamic help.
  • Xcode (Commercial, free with Mac OS X. Mac only.) Here are instructions on setting up Xcode to work with Drupal.
  • PhpStorm (Commercial. Proprietary. Windows, Mac OS X, Linux. Java Based.) Code hinting, X-Debug.

SQL & Database tools

There is software that can aid your SQL and database needs with features ranging from queries to administration.

  • DbVisualizer – Free & Commercial universal db tool for linux, windows and OSX. Works with any database that has jdbc drivers available.
  • phpMyAdmin – Industry-standard PHP tool for querying, modifying and administering a MySQL database, included in most shared hosting packages (if not, find a different host! Or just install it yourself, not hard). For local database installations you could tryphpminiadmin which is an order of magnitude faster than phpMyAdmin, but has fewer features.
  • Adminer – Adminer (formerly phpMinAdmin) is Free & Open Source, full-featured database management tool written in PHP. Conversely to phpMyAdmin, it consist of a single file ready to deploy to the target server. Adminer is available for MySQL, PostgreSQL, SQLite, MS SQL and Oracle. See also Adminer vs. phpMyAdmin comparison.
  • pgadmin3 (Free. Windows/Linux/Mac PostgreSQL). Industry-standard for administering a PostgreSQL database, the SQL99 reference database. Runs from your desktop, SSL aware, no need to install anything on your server. The application also includes a syntax highlighting SQL editor, a server-side script editor, an SQL/batch/shell job scheduling agent, support for the Slony-I replication engine and much more.
  • MySQL Workbench (Free. Windows/Mac/Linux. Source available. MySQL only.) – A GUI from MySQL allowing developers to design, model, query and administer MySQL databases. Replaces the MySQL GUI Tools Bundle.
  • Toad for MySQL (Free. Windows. MySQL only.) – Toad for MySQL Freeware is a tool that improves the productivity of developers and administrators by providing an easy-to-use development environment.

    • Version Control Integration,
    • Macro Record and Playback,
    • Database Browser,
    • Code Snippet Editor,
    • Security Manager,
    • SQL Editor, Fast,
    • Multi-Tabbed Schema Browser,
    • DB Extract,
    • Compare-and-Search Utility,
    • Import/Export Utility.
  • FlySpeed SQL Query (Free. Windows. MySQL/PostgreSQL) — Builds queries without needing deep knowledge of SQL syntax and performs data manipulations such as export and reporting.
  • Navicat (Free & Commercial. Windows, Linux, Mac. Versions for MySQL, Oracle, PostgreSQL.)
  • Sequel Pro (Free. Mac. MySQL)
  • SQLyog (Free Community Edition, Enterprise Edition. Windows. MySQL)
  • HeidiSQL (Free & Open Source. Windows. MySQL only.)

Other Tools

  • PuTTY (Free. Windows only.) – An SSH and telnet client.
  • WinSCP – WinSCP is an open source free SFTP client and FTP client for Windows.
  • 7 Zip (Free. Open Source. Windows is the primary platform, with ports listed on thedownload page.) – Extracts archived and compacted files (such as tarballs).
  • Cygwin (Free. Open Source. Windows only.) – Allows Windows users to use a Unix like shell. This is particularly useful for interfacing with git and patching files; read more.
  • Filezilla (Free. Open Source. Windows, Mac, and Linux.) – Graphical FTP client
  • IE Net Renderer – Check your site on IE 6 & 7 without Windows
  • UnxUtils (Free. Open Source. Windows only.) – a lightweight option for adding some Unix command line utilities such as patch and grep to Windows, for those not wishing to download Cygwin.
  • Realtime CSS Viewer Gem (Free, runs on Ruby) – This is a CSS viewer that monitors your changes as you edit in any text editor.This link does not work anymore


Working with files in Drupal 7

Drupal 7 has replaced the old Upload module (which provided the “Attachments” feature on nodes) with a FileField (as FileField is now in core). So, while there’s no longer the option to enable attachments for the content type within the main page of the content type edit form, you can now add a new File field to the content type. Once you’ve saved the new field for your content type, the upload form will appear on the edit page for nodes of that type.

Since in Drupal 7 both nodes and comments are “entities”, you can attach fields to both in the same way. When Comment module is enabled and you click to edit one of your content types, you’ll see both a Manage Fields tab (for fields on the node) and a Comment Fields tab (for fields on the comments for this particular content type).

ที่มา :

จากข้อความด้านบนสรุปได้ว่าโมดูล Upload ใน Drupal 6 ไม่มีแล้วใน Drupal 7 เพราะมีการสร้าง FileField ไว้ในแกนหลักของ Drupal 7 แล้ว การจะใช้งานก็ให้ไปทำการเพิ่มฟิลด์ให้กับ Content type ที่จะใช้ เช่นต้องการให้ Article สามารถทำการ Upload ไฟล์ได้ ก็ให้ไปเพิ่มฟิลด์ที่ Article ดังรูป


หลังจากกด Save จะแสดงหน้ากำหนดค่า


การกำหนดค่าที่สำคัญคือ file extension ซึ่งปกติจะมีแต่ txt แต่ถ้าต้องการให้ Upload ไฟล์ชนิดอื่นได้ด้วย ให้เพิ่ม file extension คั่นด้วย comma ดังรูป


ที่มา :

Upgrade จาก Drupal 6 ไปเป็น Drupal 7

ที่มา :

Upgrade Steps

    1. Backup your existing site and database.
    2. Update Drupal core, modules and themes to the latest releases for your existing Drupal version.
    3. Log in as user ID 1 (the site maintenance user).
      This is the user name that you created during the installation process for your site.
    4. Put your site in maintenance mode
      Go to the site maintenance page, select “Off-line” and save the configuration. If you have defined a custom maintenance theme in your settings.php file, comment it out before proceeding.
    5. Change all themes to Garland
      Go to the Themes page, enable “Garland” and select it as the default theme. If you have been using a separate theme for administration, select “Garland” for your administration theme as well. If you are using a custom maintenance theme, comment out 'maintenance_theme' => 'your theme name' in settings.php.
    6. Disable non-core modules
      Go to the Modules page and disable all modules that are not listed under “Core – required” or “Core – optional”. It is possible that some modules cannot be disabled, because others depend on them. Repeat this step until all non-core modules are disabled.If you know that you will not re-enable some modules for the target Drupal version and you no longer need their data, then you should uninstall them under the Uninstall tab after disabling them.You can also use Drush to disable all non-core modules (first save a list of all enabled modules):

      drush pml --no-core --type=module --status=enabled --pipe > modules.txt
      xargs -a modules.txt drush -y dis
      xargs -a modules.txt drush -y en
    7. Remove default settings file
      On the command line or in your FTP client, remove the file sites/default/default.settings.php
    8. Remove all old core files and directories
      Remove all old core files and directories, except for the ‘sites’ directory and any custom files you added elsewhere. If you made modifications to files like .htaccess or robots.txt, you will need to re-apply them from your backup, after the new files are in place.
    9. Remove uninstalled modules
      If you uninstalled any modules, remove them from the sites/all/modules and other sites/*/modules directories. Leave other modules in place, even though they are incompatible with Drupal 7.x.
    10. Download Drupal
      Download the latest Drupal release of the target version to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.On a typical Unix/Linux command line, use the following commands to download
      and extract:wget -zxvf drupal-x.y.tar.gzThis creates a new directory drupal-x.y/ containing all Drupal files and directories. Copy the files into your Drupal installation directory:cp -R drupal-x.y/* drupal-x.y/.htaccess /path/to/your/installationIf you do not have command line access to your server, download the archive using your web browser, extract it, and then use an FTP client to upload the files to your web root.
    11. Re-apply modifications to core files
      Re-apply any modifications to files such as .htaccess or robots.txt.
    12. Make your settings.php file writeable
      Make your settings.php file writeable, so that the update process can convert it to the new format.
    13. Run the update script
      Run update.php by visiting (replace www.example.comwith your domain name). This will update the core database tables.If you are unable to access update.php do the following:

      • Open settings.php with a text editor.
      • Find the line that says:$update_free_access = FALSE;
      • Change it into:$update_free_access = TRUE;
      • Once the upgrade is done, $update_free_access must be reverted to FALSE.
    14. Backup your database
      Backup your database after the core upgrade has run.
    15. Upgrade fields
      If you are upgrading from Drupal 6 to 7 and were using CCK (and perhaps additional modules) to create fields for your content types, you will need to upgrade the data in those fields as a separate step. Download the Drupal 7 CCK module, and turn on Content Migration. Go to Structure > Migrate Fields or http://example/com/admin/structure/content_migrate for a page to walk you through the migration process. There are now several types of fields in core, but not every type. You might need to download Drupal 7 versions of contributed modules to support other types of fields (such as the References module for nodereference fields and/or userreference fields). Learn more about migrating content from CCK to Core Fields.
    16. Update contrib modules and themes
      Replace and update your non-core modules and themes, following the procedures at
    17. Check the Status Report
      Go to the Status Report page and verify that everything is working as expected.
    18. Make sure settings.php is secure
      Ensure that $update_free_access is FALSE in settings.php.
      Remove write permissions.
    19. Check Drupal Core Modules
      Make sure that standard modules from a typical fresh install are engaged. In a Drupal 6 to 7 upgrade, some modules that may not be engaged are: ‘Dashboard’, ‘Contextual Links’, ‘Overlay’, ‘Field’, ‘File’, ‘Image’ and ‘Shortcut’.
    20. Remove your site from Maintenance Mode
      Go to the Maintenance Mode page and disable the “Put site into maintenance mode” checkbox and save the configuration.

Note that the file structure, particularly the locations of core and contributed modules have changed in Drupal 8.


  1. Backup ไฟล์ทั้งหมด และฐานข้อมูล
  2. Update โมดูลทั้งหมด ทั้ง core และ โมดูล กับ ธีม ให้ update ให้หมด
  3. ล็อกอินด้วย user ที่สร้างตอนติดตั้งเว็บไซต์
  4. เซ็ตให้เว็บไซต์ของเราเป็น maintenance mode
  5. เปลี่ยนธีมให้เป็น Garland
  6. ปิดการใช้งาน non-core modules
  7. ลบไฟล์ sites/default/default.settings.php
  8. ลบไดเร็กทอรี่ทั้งหมด ยกเว้น sites
  9. ลบโมดูลที่ปิดการใช้งานในข้อ 6
  10. ดาวน์โหลด Drupal 7
  11. x
  12. x
  13. ทำการ Update ด้วยการเรียก 

หลังจากทำการ Update เสร็จแล้ว ถ้าต้องการให้ Admin ใช้งาน Overlay, Dashboard ให้ไป enable โมดูล Overlay, Dashboard

และยังมีอีกหลายๆ core modules ที่หลังจาก Update แล้วต้องไป enable เอง ไม่เหมือนการติดตั้งใหม่ core modules ต่างๆนี้จะ enable มาให้เลย

ปัญหาที่พบหลังการ Update

  1. Drupal 7 มี administrator role ซึ่ง Drupal 6 ไม่มี เลยไปเพิ่ม role เองที่ฐานข้อมูล จากนั้นมาที่หน้า admin -> people -> permissions เพื่อเพิ่มสิทธิให้กับ administrator role
  2. user ที่เป็น  administrator ไม่มี UI ให้กำหนดรูป (ยังไม่ได้หาทางแก้)
  3. content type ไม่เหมือนกัน ระหว่าง  Drupal 6 และ  Drupal 7 ทำให้ติดตั้ง CKEditor บนตัว update ไม่สามารถใช้งาน CKEditor ได้ (แต่ติดตั้ง CKEditor บน Drupal 7 ที่ install ใหม่ สามารถใช้งานได้ปกติ)
  4. enable โมดูล Dashboard แล้วทำงานได้ แต่เมนูนำทางต่างๆไม่ขึ้น (อาจต้องไปกำหนดค่าที่ไหนซักที่)

สรุปการ Update

การ Update จาก Drupal 6 ไปเป็น Drupal 7 สามารถทำได้ แต่ไม่สมบูรณ์นัก (เฉพาะโมดูล core ไม่นับโมดูลที่ติดตั้งเพิ่ม) ดังนั้นถ้าจำเป็นต้อง Update จาก Drupal 6 ไปเป็น Drupal 7 จริงๆ ก็ต้องเผื่อเวลาในการแก้ไขปัญหาจุกจิกต่างๆไว้พอสมควร

Drupal กับ .htaccess

Install drupal เสร็จ เข้าไปแก้ไข config ของ Theme แล้วมี error ประมาณว่า
* warning: fopen(sites/default/files/.htaccess) [function.fopen]: failed to open stream: Permission denied in /var/www/jack/includes/ on line 129.
* Security warning: Couldn’t write .htaccess file. Please create a .htaccess file in your sites/default/files directory which contains the following lines:
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks
ทั้งที่ สร้างไฟล์ .htaccess และให้สิทธิแล้ว แต่ก็ไม่หาย
วิธีแก้คือ ให้เปลี่ยน permission ของ directory files ให้เป็น 777 ซะ

ติดตั้ง GD Library

หลังจากติดตั้ง Drupal แล้ว
มี message แจ้งเกี่ยวกับ GD Library
ให้ทำการติดตั้ง Package  php5-gd ด้วยคำสั่ง
sudo apt-get install php5-gd
จากนั้น restart apache ด้วยคำสั่ง
sudo /etc/init.d/apache2 restart

Apache : How to Enable mod_rewrite on Ubuntu

เปิดใช้โมดูล mod_rewrite

sudo a2enmod rewrite


sudo nano /etc/apache2/sites-enabled/000-default

แก้ไข none ให้เป็น all

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

สุดท้าย บูต Apache ใหม่

sudo /etc/init.d/apache2 restart
apache2ctl -M

อย่าลืมตรวจสอบไฟล์ .htaccess มาได้ copy มาไว้ที่ /var/www แล้วหรือไม่ เพราะบางครั้ง มันไม่ได้ copy มา ไม่รู้ว่าทำไม ‘-_-

เท่านี้ Clean URL ก็จะใช้ได้แล้ว

ตัวอย่าง code การใช้ Python ติดต่อ XML-RPC ของ Drupal

 #!/usr/bin/env python

import xmlrpclib
server = xmlrpclib.Server("http://localhost/drupal/xmlrpc.php")

for method in server.system.listMethods():
        print method, server.system.methodHelp(method)

เมื่อสั่ง run จะได้ output ดังนี้


Returns an array describing the return type and required parameters of a method.

Returns a struct describing the XML-RPC specifications supported by this server.

Returns an array of available methods on this server.

Returns a documentation string for the specified method.