Drupal

mihalis's picture

Run Drupal sites with Drush

I wrote "Run Drupal sites with Drush" for Linux User and Developer magazine issue 142!

Drush is a command line shell and scripting interface for Drupal.

Image: 
mihalis's picture

Using R to process Apache Log Files

R can help you check for security threats.

As my site is a Drupal site, I want to monitor the GET /?q=node/add HTTP/1.1, GET /?q=user/register HTTP/1.1, GET /?q=node/add HTTP/1.0 and GET /?q=user/register HTTP/1.0 requests that indicate hack attempts.

After inserting the log file into R using read.table(), I used the following command to select the entries that match my criteria.

HACK = subset(LOGS, V6 %in% c("GET /?q=node/add HTTP/1.1",
"GET /?q=user/register HTTP/1.1",
"GET /?q=node/add HTTP/1.0",
"GET /?q=user/register HTTP/1.0" ))

Last, I created a Bar Plot to visualize my data.

Image: 
mihalis's picture

Programming a Drupal Module.

I wrote "Programming a Drupal Module" for MacTech magazine (December 2013 issue).

One way to extend Drupal’s default functionality is by using modules. If a module that fit your needs does not exist, then you can develop your own. Alternatively, you can make changes to existing modules.
This article teaches you the basics of Drupal Module Development.

Image: 
mihalis's picture

An unrecoverable error occurred.

The problem

I could not create new content on Drupal 7. The error message was: ""An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (2 MB) that this server supports."

The solution

The mod_rewrite Apache 2 module was not enabled.
It can be enabled using the following command (Debian 7):
a2enmod rewrite

You then have to restart Apache:
service apache2 restart

You many also need to change file /etc/apache2/sites-enabled/000-default.
Change AllowOverride None to AllowOverride All (2 times) and you are done!
(do not forget to restart Apache)

mihalis's picture

www-data PHP & Postfix emails

It all started with an email from my Linode server telling me

"Linode Alert - disk io rate".

After deleting manually many email messages using the following command:
# postsuper -d ALL deferred
postsuper: Deleted: 146 messages

I had to start finding the problem...
What almost solved the problem was creating PHP logs about emails:

# find . -name php.ini
./php5/cli/php.ini
./php5/apache2filter/php.ini


; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =

mail.log = /var/log/php.mail.log

Changed permissions to /var/log/php.mail.log so that it can be written by everyone...

Then I was able to produce really useful output

There was a php script called sys09725827.php on both my WordPress and Drupal installations!
I deleted the script and everything is fine now.

  • public_html/wp-includes/fonts/sys09725827.php
  • public_html/themes/bartik/css/sys09725827.php

The following link from Drupal.org helped a lot:
https://drupal.org/SA-CORE-2013-003

Had to edit:

  • ./sites/default/files/.htaccess
  • /tmp/.htaccess


# cat /tmp/.htaccess
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Deny from all
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006

# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003

# If we know how to do it safely, disable the PHP engine entirely.

php_flag engine off

Pages

Subscribe to RSS - Drupal