1

I am trying to create an install file but Magento is not running that file, although it is putting an entry in to the core_resource table.

I have deleted the row which was created and loaded the page again. The row was re-created but the install file was not called (There is only and echo statement and die statement in that file to check if its working).

Trying to solve this problem I found this question on stackoverflow and have followed the advice, but I cant seem to get a result. When I break the config, I get a 404 page, I have changed the file permission so there is no problem there. Finally I have loaded the config, in there I have found Ps_Prefs_Model_Mysql4_Setupcore_setupcore_writecore_read, so Magento is doing something with my file, but I cannot tell what from this.

I'm hoping that it is a simple casing issue (which I cannot see, so below is my files and my config)

enter image description here

I also tried renaming the install file mysql4-install-0.1.0.php, that had no effect

<config>
 <modules>
 <Ps_Prefs>
 <version>0.1.0</version>
 </Ps_Prefs>
 </modules>
<global> 
 <models>
 ........
 </models>
 <resources>
 <prefs_setup>
 <setup>
 <module>Ps_Prefs</module>
 <class>Ps_Prefs_Model_Mysql4_Setup</class>
 </setup>
 <connection>
 <use>core_setup</use>
 </connection>
 </prefs_setup> 
 <prefs_write>
 <connection>
 <use>core_write</use>
 </connection>
 </prefs_write>
 <prefs_read>
 <connection>
 <use>core_read</use>
 </connection>
 </prefs_read>
 </resources>
 ............
</global>

In log/system.log I get this message

2013年10月01日T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: Entity: line 8: parser error : Start tag expected, '&lt;' not found in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013年10月01日T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: &lt;/config&gt;--&gt; in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013年10月01日T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^ in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013年10月01日T09:36:14+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /Users/tsimps/Sites/magentoDevTest/lib/Zend/Controller/Response/Abstract.php:766
[2] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Response/Http.php:83
[3] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Model/App.php:354
[5] /Users/tsimps/Sites/magentoDevTest/app/Mage.php:683
[6] /Users/tsimps/Sites/magentoDevTest/index.php:87
</pre>

Cache is disabled and has been cleared (just incase)

I am using version 1.7.0.2

asked Oct 1, 2013 at 9:48
7
  • 3
    Most probably your config.xml is not valid. Check if all the tags are closed. Also don'y put your install script in the folder mysql4. Move it one level up. Commented Oct 1, 2013 at 9:57
  • 1
    To add on @Marius comment, use w3schools.com/xml/xml_validator.asp to validate the XML structure Commented Oct 1, 2013 at 9:59
  • Moving it up one level worked, but why does a prefs_setup still get added to the core_resource table? Commented Oct 1, 2013 at 10:10
  • @tony09uk. huh?. This is how it should behave. This means that your module was installed. Commented Oct 1, 2013 at 10:15
  • 1
    Hi tony, what happening to your module was that config.xml has declaration for set up and it was at correct location (prefs_setup was under sql folder) when it runs, it created the entry in your core_resource table. And the table was not getting created because script was missing at it's location. Commented Oct 1, 2013 at 10:28

1 Answer 1

2

The row is created when you have an entry inside of your config.xml. If no setup file exists (or it is in the wrong place) magento just creates the row in the core_resource table and doesn't call any script.

This is a problem if you later add a install-script, which is never called, because the entry already exists.

So first write an install script, then add the setup to the config.xml and later add upgrade-scripts if needed,

answered Nov 10, 2013 at 23:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.