Drupal 6 to Drupal 7 - table already exists error

I have module in drupal 6 and try to convert that to drupal 7.

In Drupal 6 the test.install file have

function test_schema(){
$schema = array();

$schema['test_table'] = array(
'description' => 'test table',
'fields' => array(
'description' => 'id field',
'type' => 'serial',
'not null' => TRUE
'name' => array(
'description' => 'name of user',



function test_install()
function test_uninstall()

When I place the same module in drupal 7 and install, I got DatabaseSchemaObjectExistsException: Table test_table already exists. in DatabaseSchema->createTable() (line 657 of /includes/database/

From understood
_install and _uninstall functions need not to be written in drupal 7. only modulename_schema function is enough and drupal 7 will do install and uninstall automatically.

drupal 6 to drupal 7 - schema - datetime issue

I have a module.install file with datetime column as like
below in drupal 6

'startdate' => array(
'description' => 'The start date.',
'type' => 'datetime',
'enddate' => array(
'description' => 'The end date.',
'type' => 'datetime',

Placed that module in drupal 7 and when I try to install the module I got the following error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL COMMENT 'The start date.',

Based on information from

We have use the datetime as below:

'startdate' => array(
'description' => 'The start date.',
'mysql_type' => 'datetime',
'enddate' => array(
'description' => 'The end date.',
'mysql_type' => 'datetime',

same way for tinyint specify mysql_type=>'tinyint'.

How to install extension php?

$ sudo apt-get install extension_name
The above command install the specified extension in unix/linux box.

How to install intl extension php?

$ sudo apt-get install php5-intl

How to install PHP accelerator APC?

sudo apt-get install php-apc

The extension already installed then it will upgrade if any new version released.

If no latest version release after our installation then it show message like below

$ sudo apt-get install php-apc
[sudo] password for sasikala:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-apc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 404 not upgraded.

How to check particular php extension installed in linux?

This command shows the extension installed or not
$ php --re extensionname

example :
$ php --re intl
Exception: Extension intl does not exist

If exists then display the extension like below with version and its contents

Extension [
extension #46 intl version 1.1.0 ] {

- INI {
Entry [ intl.default_locale ]
Current = ''
Entry [ intl.error_level ]
Current = '0'

- Constants [171] {
Constant [ integer INTL_MAX_LOCALE_LEN ] { 80 }
Constant [ string INTL_ICU_VERSION ] { }

How to find which php is used or where the php located in command line?

$Which php
this command show the path of the php used.

$ which php

How to find which php.ini used in console?

php -i display the phpinfo(). Grep that result and find the php.ini file like below

$ php -i | grep Config
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

Syndicate content