Magento / Zend does not allow symbolic links

Does anyone know why Magento will not allow symbolic links for .phtml template files that are outside the application / design folder?

If I make a symbolic link in this folder, it works fine, but if it is connected outside of it, it does not work. So this seems like some access / security rights, but I can’t find the information anywhere.

Perhaps a Zend setup? http://zend-framework-community.634137.n4.nabble.com/Zend-Tool-not-working-with-symbolic-links-in-include-path-td662569.html

Is anyone

AUXILIARY: Thanks to Alan's suggestion below, I found a workaround - since I will use this only for local development, I am quite satisfied. If this helps someone else, I am going to add it here. Therefore, I insert the following lines into core / Mage / Core / Block / Template.php, immediately after the line Varien_Profiler :: start ($ fileName);

$storeId = Mage::app()->getStore()->getId(); $theme = Mage::getStoreConfig('design/package/name', $storeId); Mage::Log($this->_viewDir.DS.$fileName); $includes = $this->_viewDir.DS.$fileName; if(strpos($includes, 'frontend/'.$theme )) { include $this->_viewDir.DS.$fileName; }; 

Using the IF statement stops any base patterns that double, and only allows you to create your own theme templates.

+6
symlink zend-framework magento
source share
5 answers

As with Magento 1.5.1.0 (maybe 1.5.x?), You can choose the option System> Configuration> Developer> Template Settings> Allow Links .

No need for dirty hacks / workarounds. :-)

+18
source share

This was caused by a change in 1.4.2, where Magento no longer supports symbolic folders. If you look in Template.php

  $includeFilePath = realpath($this->_viewDir . DS . $fileName); if (strpos($includeFilePath, realpath($this->_viewDir)) === 0) { include $includeFilePath; } else { Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true); } 

you see that it will not load if the template is not under "viewDir".

+5
source share

found another nice little solution that works for me:

 sshfs 192.168.1.12:/srv/www/vhosts/dev.****.*****.de/media/catalog/product/ catalog/product/ -o allow_other 

this mounts the remote file system via sshfs, the allow_other option is required so that files mounted from a remote mailbox without rights to the remote file:

This option allows you to use -o allow_other in your SSHFS command, which allows your non-root user to access the specific resource that you are mounting.

Hope this helps any of you.

+3
source share

I also use symbolic links for my custom code, and I was able to overcome this problem by using mount -bind instead of creating symbolic links, for example. custom themes directory: / home / user / workspace / magento / app / design / frontend / default / mytheme

 cd <magento dir>/app/design/frontend/default mkdir mytheme sudo mount --bind /home/user/workspace/magento/app/design/frontend/default/mytheme mytheme 

This method will not work on OSX.

+2
source share

Add registration code to the base template block

 #File: app/code/core/Mage/Core/Block/Template.php public function fetchView($fileName) { ... Mage::Log($this->_viewDir.DS.$fileName); var_dump($this->_viewDir.DS.$fileName); include $this->_viewDir.DS.$fileName; ... } 

Ultimately, creating a template block is an include call with a system path. Once you get the Magento path that will be created for your template, create a single line PHP file

 <?php include('/path/that/was/logged/foo.phtml'); 

And try loading the template. This should allow you to isolate the reason for the failure of a particular call. My immediate suggestion is PHP safe mode, but for a long time I had to deal with the limitations of shared hosting.

Good luck

0
source share

All Articles