Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?

share|improve this question
 
Can you add other modules, e.g. the developer toolbar or something else known not to screw up a system? If so then the problem is with your module not the setup of MySQL etc. –  ʍǝɥʇɐɯ Jun 30 '11 at 15:53
add comment

4 Answers

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.

share|improve this answer
 
Thanks for the reply. The live system has GRANT ALL for my user so I guess the MySQL permissions are more than enough. Thanks though. –  sulman Jun 30 '11 at 15:42
 
I think this is off the mark because Magento uses its own connector to access the database. –  ʍǝɥʇɐɯ Jun 30 '11 at 15:46
 
Doesn't matter how magento connects, if it's a permissions issue, then this is how you'd compare the permission sets between the two systems. Just because magento has its own connector doesn't mean it can magically bypass the MySQL grant system. –  Marc B Jun 30 '11 at 15:48
add comment
  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

share|improve this answer
 
Thanks Alan. 1) Yep, I’m confident that all the required module files are installed correctly on the live server (as it is replicated from the dev server). 2) I am removing the listing in the db to test. 3) I will have a look at this function and debug. Thanks –  sulman Jun 30 '11 at 16:18
add comment

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.

share|improve this answer
 
Thanks for the reply. Yes everything appears to unpack correctly and the module appears in the admin correctly. As mentioned the file structure is identical to the dev server and it installs correctly on that. Thanks. –  sulman Jun 30 '11 at 15:59
 
Is it registered already? Open phpmyadmin and search for your module name. It will be in a config table, just the one key. Take it out and then it should magically install itself. –  ʍǝɥʇɐɯ Jun 30 '11 at 16:18
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.