How to install IonCube loader on CentOS 6.3

Download and uncompress the latest IonCube version:

wget # 32 bit
wget # 64 bit
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

Then we go to the new IonCube source directory:
 cd ioncube/

 mv /usr/lib/php/modules/

Now edit /etc/php.ini and add the line zend_extension = /usr/lib/php/modules/

What is stopping Varnish?

Every so often with Pressflow and Varnish you might find that your anonymous users aren't being cached via Varnish.

A quick way to see whether your anonymous pages are being served is to add some debugging headers to Varnish by adding some code like the snippet here to vcl_deliver()

sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Varnish-Cache = "HIT";
else {
set resp.http.X-Varnish-Cache = "MISS";

and hit them with

curl -I

How to insert a block or a region in the middle of Drupal node content

The solution for Drupal 7.10:

/** in template.php **/

function THEME_preprocess_node(&$variables) {
//load your adblock
$adblock = block_load('block', '1');
$output .= drupal_render(_block_get_renderable_array(_block_render_blocks(array($adblock))));
$variables['ad'] = $output;

/** in node.tpl.php **/

$array = explode("", $body[0]['value']);
$array[1] = $ad. $array[1];
$content['body'] = implode("", $array);
print render($content['body']);

Inserting Adsense Into Content - Drupal 6.X

WD cron: Attempting to re-run cron while it is already running.

If you see the following error when running 'drush cron' command:

WD cron: Attempting to re-run cron while it is already running.                       [warning]
Cron run failed. 

then you can try:

drush --yes vset cron_semaphore 0
drush cron

If it doesn't help then fire up:

drush sqlc
DELETE FROM variable WHERE name="cron_semaphore";
DELETE FROM variable WHERE name = "cron_last";
drush cc all
drush cron

Another MySQL daemon already running with the same unix socket.

After upgrading to CentOS 5.6 MySQL deamon on my server didn't want to start complaining about Another MySQL daemon already running with the same unix socket. Firing up service mysqld restart didn't help. So I had to

rm -rf /var/lib/mysql/mysql.sock
service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

How to install wkhtmltopdf on CentOS?

First, we need to know which version of wkhtmltopdf binary - 32bit or 64 bit- we need. To do so run this command in CLI:

getconf LONG_BIT

Now depending on the version of your CentOS dowload the first or the second link respectively for 32 and 64 bits:

cd /usr/src

Install necessary packages:

yum install xz urw-fonts libXext openssl-devel libXrender

Drupal Performance Best Practices

As Drupal is used more and more for large, high-traffic websites, it has become very important to focus on performance enhancements to Drupal and the underlying server infrastructure. In doing so, we are looking at improving both the number of requests that a Drupal site can handle, and to decrease the amount of time required to load a particular page, or an entire site in general.

Sharing SSH session with screen

Sometimes, it is particularly illuminating to see how something is setup in SSH by another person in remote place. Particularly, we want the equivalent of a bunch of people huddled in front of a monitor while one person types. Surprisingly, this can be accomplished quite easily in Linux. Actually, this is one step better, anyone can type in the command line at any time, so no one actually monopolizes the keyboard. One person can create the screen by selecting a name for the session and then typing sudo screen -L -S

Deleting _vti_cnf directories recursively

There are a number of issues concerning Drupal sites suddenly or slowly becoming broken along with error messages that have "_vti" as part of the issue. The certain themes (such as Multi-Flex) will definitely break the entire Drupal site if FrontPage Extensions are turned on, on a site. This is because the FrontPage extensions are somehow creating shortcuts in a directory that is parsed first before the main site files are parsed.

Optimal my.cnf settings for large sites

log-slow-queries  = /var/log/mysql_slow.log
open_files_limit =24000
thread_concurrency = 8
query_cache_size = 32M
thread_cache_size = 8
myisam_sort_buffer_size = 64M
read_rnd_buffer_size = 8M
read_buffer_size = 2M
sort_buffer_size = 2M
table_cache = 512
max_allowed_packet = 32M
key_buffer = 384M
max_heap_table_size = 64M
query_cache_limit = 2M
innodb_file_per_table = 1
innodb_additional_mem_pool_size = 16M
innodb_flush_log_at_trx_commit = 0

Syndicate content