1

I am receiving the following error

Fatal error: Class 'Ns_Module_Model_Mysql4_Setup' not found in /Users/tony09uk/Sites/magentoDevTest/app/code/core/Mage/Core/Model/Resource/Setup.php on line 234

I have added this file in my config and the exact same file path has been created for the setup file

etc/config.xml

<global>        
    <models>
        .....
    </models>

    <resources>
        <module_setup>
            <setup>
                <module>Ns_Module</module>
                <class>Ns_Module_Model_Mysql4_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </module_setup> 
        .....
    </resources>

The file path is Ns_Module_Model_Mysql4_Setup

class Ns_Module_Model_Mysql4_Setup
extends Mage_Core_Model_Resource_Setup 
{}

Why can't magento find this? I have checked the file paths are the same and checked the casing is the same, what am I doing wrong?

3
  • you have module_setup to start the xml section but prefs_setup is that another typo? Commented Sep 30, 2013 at 13:41
  • Yes it is, sorry. you probably won't believe that I reviewed this question before posting. I think I will copy and paste next time
    – tony09uk
    Commented Sep 30, 2013 at 13:44
  • could you activate MAGE_IS_DEVELOPER_MODE and set display errors then you should get a more complete error message. Commented Sep 30, 2013 at 14:34

2 Answers 2

3

Check the file permissions. Remember the webserver typically runs as a different user so all files need to have read permission for all users. Also the directory it's in must be similarly executable.

chmod a+r app/code/local/Ns/Module/Model/Mysql4/Setup.php
chmod a+rx app/code/local/Ns/Module/Model/Mysql4/
2
  • app/code/local/Ns/Module/Model/Mysql4/Setup.php and app/code/local/Ns/Module/Model/Mysql4 are returned with -rw-r--r--
    – tony09uk
    Commented Sep 30, 2013 at 14:41
  • I deleted those files and a recreated them, it now works. I have no idea why, I have re done the command you advised and it show the same permissions
    – tony09uk
    Commented Sep 30, 2013 at 14:48
1

The class name in your file does not appear to match the name that Magento is looking for. You should update Ps_Prefs_Model_Myql4_Setup to Ns_Module_Model_Mysql4_Setup in your php.

2
  • Sorry, I was trying to make it more generic so that it would be something an answer that would suit others too, I will edit the question
    – tony09uk
    Commented Sep 30, 2013 at 13:37
  • 1
    Ah thought it was too easy ;) Commented Sep 30, 2013 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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