Tag: php
-
Clear Varnish cache via PHP: a Drupal 7 proof of concept
Using Varnish as reverse proxy or proxy is an useful approach to reduce the load of webservers like Apache. In Drupal 7 I’ve to clear the varnish cache of a specific domain when Drupal caches are globally cleared. Drupal has the right hook invoked when cache are cleared: Now this piece of code simply adds […]
-
Cron cannot run on Drupal: the drupal_goto() case
Sometimes you want to redirect a page to another on drupal. You can do this using a simple function called drupal_goto(). On few sites I’ve enabled the PHP filter module and then created a new page with PHP code input format with drupal_goto(‘node/2’) to redirect the current page to a specified node. Bad idea. I’ve […]
-
PEAR install quick howto on Debian Lenny: Image_Graph
Tested on Debian Lenny. Time elapsed before a working script < 10 minutes 😉 Install PEAR installer: # apt-get install php-pear First, type: pear -h to get help. On root shell type: # pear install –alldeps Image_Graph Install failed with error: Failed to download pear/Image_Graph within preferred state “stable”, latest release is version 0.7.2, stability […]
-
Raise Drupal files upload limit
In your Drupal site, go to admin/settings/uploads Raise upload limits. If the value you want to insert is greater than PHP allowed value: On bottom of your .htaccess file (drupal/.htaccess) add these lines: # upload settings # cfr. http://it.php.net/manual/it/function.ini-set.php php_value post_max_size 50M php_value upload_max_filesize 50M php_value memory_limit 128MChange values as you wish. Return to admin/settings/uploads […]
-
HTTP 301 Page moved in Drupal
Scope: Move an old document to a new URL with HTTP 301 Permanent Redirect. Module used (required if you don’t want to modify an existing page): URL aliases. Create a new page (or edit an old one). Select “PHP code” in input type. Fill the url alias box, with the old document path Insert the […]