Posts

Showing posts from August, 2011

Apache forbidden by SELinux and access permissions

This post is a very trivial one, but it's just that I've found myself ignoring these things time and again. Every time I need to setup a new system for development in PHP or Drupal, I've ran into almost all of these small "issues". I would always prefer to have the working copy of the code somewhere in my home directory , and maybe have it symlinked from the directory which is set as my "Document Root" in Apache. # cd /var/www/html # ln -s ~ausmarton/Public/website/drupal-7.7 drupal Assuming, everything is set up and will work, I go ahead to access the application in my browser, just to find out that all I can get is a big "Forbidden"  message. Now, this happens because, in linux, to be able to access the contents of a directory, you should have the 'x' permission. But, unfortunately, home directories are by default set not to be accessible by anyone other than the designated user. drwx------. 37 ausmarton ausmarton  4096 Aug 25 17:08 a...

Drupal 6 db_create_table cannot handle primary/unique keys

The Drupal API provides a function called db_create_table which allows you to create a table in your database. If you need to add a table for a module, after the module is installed, then you could use this function in your update hook. The documentation of db_create_table says that it accepts three arguments, an array which will contain the query result, the name of the table and an array containing the schema definition of the table. The schema definition has to be in the structure defined by the Drupal Schema API . What I recently noticed was, that db_create_table does not seem to accept primary/unique keys in the schema definition. It seems like you need to first create a table without any constraints. For this, you'll have to provide db_create_table with an array containing the schema without any key constraints. After doing that, you can use db_add_primary_key in order to create a primary key. Similarly, there is a function to create a unique key constraint - db_add_uniq...