sulman
sulman

Reputation: 2461

Magento Module install SQL not running

I have written a module that is refusing point blank to create the tables within my mysql4-install-1.0.0.php file....but only on the live server.

The funny thing is that on my local machine (which is a mirror of the live server (i.e. identical file structure etc)) the install runs correctly and the table is created.

So based on the fact that the files are the same can I assume that it is a server configuration and or permissions problem? I have looked everywhere and I can find no problems in any of the log files (PHP, MySQL, Apache, Magento).

I can create tables ok in test scripts (using core_read/write).

Anyone see this before?

Thanks

** EDIT ** One main difference between the 2 environments is that on the live server the MySQL is remote (not localhost). The dev server is localhost. Could that cause issues?

Upvotes: 4

Views: 6740

Answers (5)

Lyubomir
Lyubomir

Reputation: 301

For me, the issue appeared using Windows for development. Linux system is case sensitive. In my config.xml the setup section was named camelCase while the folder was named all-lowercase. Making them the same made the script run.

Upvotes: 0

Alana Storm
Alana Storm

Reputation: 166046

  1. Is the module which your install script is a part of installed on the live server? (XML file in app/etc/modules/, Module List Module for debugging.)

  2. Is there already a record in the core_resource table for your module? If so, remove it to set your script to re-run.

  3. If you file named correctly? The _modifyResourceDb method in app/code/core/Mage/Core/Model/Resource/Setup.php is where this file is include/run from. Read more here

Upvotes: 5

dancl
dancl

Reputation: 727

the cache could be the culprit, if you manually deleted the core_resource row for your module in order to make the setup sql run again, you have to also flush the cache

probably a difference between dev and production servers is cache settings, that would explain why you only see this in production

Upvotes: 1

ʍǝɥʇɐɯ
ʍǝɥʇɐɯ

Reputation: 4022

In the Admin->System->Advanced section is your module present and enabled?

Did you actually unpack your module to the right space, e.g. app/code/local/yourcompany/yourmodule ?

Do you have app/etc/modules/yourmodule.xml - I believe that this could be the overlooked file giving rise to your problem.

Upvotes: 1

Marc B
Marc B

Reputation: 360572

Probably a permissions issue - a MySQL account used by public-facing code should have as few permissions as possible that still let it get the job done, which generally does NOT allow for creating/altering/dropping tables.

Take whatever username you're connecting to mysql with, and do:

SELECT User, Host
FROM mysql.user
WHERE User='your username here';

This will show you the user@host combos available for that particular username, then you can get actual permissions with

show grants for username@host;

Do this for the two accounts on the live and devlopment server, which will show you what permissions are missing from the live system.

Upvotes: 3

Related Questions