Drupal 7.14 Crashes Apache Server on a Windows Environment

I have experienced rare cases when visiting a particular URL where the Apache Server crashes on a fresh installation of Drupal 7.14 running WAMP on Windows XP or 7.

The common solution was to open the file causing the problem and re-save it. However, this did not explain why it was happening. Fortunately, I was able to consistently reproduce this problem when I installed the Internationalization module and visited admin/config/regional/language which would result in Apache crashing.

This information finally lead me to http://drupal.org/node/1562670

What I learned was it is actually a PHP 5.3.10 bug that triggers when processing include/require files with sizes that are exact multiples of 4096 bytes and causes PHP to segfault (!).

The reason why re-saving the files worked is because the line feeds in the file are re-formatted from \n (unix style) to \r\n (windows style) which changes the files size from the problematic value of 53248 (exactly 52 KB).

How to enable libcurl in WAMP

Having developed mostly in a MAMP environment, I have taken many things for granted. Today, while working with WAMP, I was pleasantly surprised by a “Fatal error: Call to undefined function: curl_init()”.

It took a few extra steps to get cURL working. WAMP comes preinstalled with many extensions, including cURL, but for some reason many are not enabled by default and enabling php_curl from within the WAMP menu did not solve my problem.

How to enable libcurl in WAMP

  1. Find and open c:\wamp\bin\php\php5.2.6\php.ini
  2. Uncomment ;extension=php_curl.dll
  3. Do the same for c\:wamp\bin\apache\apache2.2.8\bin\php.ini
  4. Restart WAMP and happy coding.
Still not working? A good place to start is check if Apache is loading the extension. Open both php.ini and make sure extension_dir is pointing to c:\wamp\bin\php\php5.2.6\ext

How to import a large SQL dump into WAMP

Recently I had to import a 3GB database into a local Drupal installation using WAMP in a Windows XP environment. The following method I found has consistently performed and requires very minimal setup.

All you need are:

  1. Access to command line (DOS), and
  2. WAMP
Note: the following examples assumes you have WAMP installed in c:\wamp and your SQL dump is in c:\dump
  1. First, launch command prompt via All Programs -> Accessories -> Command Prompt.
  2. Then run the MySQL command below to connect to your specified database:C:\> c:\wamp\bin\mysql\mysql5.5.16\bin\mysql.exe -use databasename –u username -p password
  3. Lastly, run the following:mysql> source c:\dump\my_database_dump.sql