Tuesday, April 5, 2016

Magento Warning: simplexml_load_string() Parser Error

Sometimes when you enable caching in magento, you will get this error:

Warning: simplexml_load_string(): Entity: line 83: parser error : StartTag: invalid element name  in /home/magento/enterprise/lib/Varien/Simplexml/Config.php on line 383

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/magento/enterprise/...', 383, Array)
#1 /home/magento/enterprise/lib/Varien/Simplexml/Config.php(383): simplexml_load_string('loadCache()
#3 /home/magento/enterprise/app/code/core/Mage/Core/Model/App.php(424): Mage_Core_Model_Config->loadModulesCache()
#4 /home/magento/enterprise/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#5 /home/magento/enterprise/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#6 /home/magento/enterprise/index.php(86): Mage::run('', 'store')
#7 {main}


I am sure you have custom theme (or extensions) installed, and you can't trust them 100%.

To quickly fix check if you can find any entries when you run:

SELECT * FROM `core_config_data` where path > 0;


If you can, then awesome, you can fix it by running:

DELETE FROM `core_config_data` where path > 0;


Flush your cache and you are good to enable cache again.

If those entries re-appear you need to investigate every single third party additions.

Rsync Multiple Examples to Exclude Files and Directories Using exclude-from

1. Exclude one directory

$ rsync -avz --exclude 'dir1' source/ destination/


2. Exclude multiple directories using pattern

$ rsync -avz --exclude 'dir*' source/ destination/


3. Exclude one file

$ rsync -avz --exclude 'dir1/dir2/file3.txt' source/ destination/


4. Exclude certain file types

$ rsync -avz --exclude '*.txt' source/ destination/


5. Exclude multiple files and folders at the same time

$ rsync -avz --exclude file1.txt --exclude dir3/file4.txt source/ destination/

or,

$ rsync -avz --exclude-from 'exclude-list.txt' source/ destination/

where: exclude-list.txt contains excluded files and folder names

e.g.
excluded-file.txt
excluded/directory/
var/log/
media/catalog/product/cache/