Magento – Custom widget’s template doesn’t show up in the front-end

blockswidget

So I have a custom widget with block defined in module's config.xml:

<config>
 <modules>
    (...)
 </modules>

 <global>
    <blocks>
        <gwidgets>
            <class>Phil_Gwidgets_Block</class>
        </gwidgets>
    </blocks>
 (...)
 </global>
</config>

Block's file is under app/code/local/Phil/Gwidgets/Block/Slider.php

I believe this is where the problem starts. I insert the widget into Wysiwyg editor in back-and, refresh the front-end and it doesn't appear. I check system log and there's this error:

Warning: file_exists(): open_basedir restriction in effect. File(/usr/share/php5/Mage/Phil/Gwidgets/Block/Slider.php) is not within the allowed path(s): (/home/www/xyz/:/usr/bin/) in /home/www/xyz/html/app/code/core/Mage/Core/functions.php on line 145

So after setting up logging function in functions.php I've found out that these are the directories where autoloader attempts to find by block class:

/home/www/xyz/html/app/code/local/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/app/code/community/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/app/code/core/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/lib/Mage/Phil/Gwidgets/Block/Slider.php
./Mage/Phil/Gwidgets/Block/Slider.php
/usr/share/php5/Mage/Phil/Gwidgets/Block/Slider.php

It nearly does it here:

/home/www/xyz/html/app/code/local/Mage/Phil/Gwidgets/Block/Slider.php

It would find it without '/Mage' in the path.

So the question is why Magento looks for Slider.php in ...local/Mage/... rather than ...local/....?

I'd appreciate any advice on how to fix this issue. 🙂

Best Answer

This problem appears because your php tries to access /usr/share/php5 directory but server does not allow that. Check permission of /usr/share/php5 directory.

Answering the question why this folder is in 'include_paths' - check your php.ini configuration and virtual host config maybe it is set there. Default value of include_paths is .:/usr/share/php:/usr/share/pear.

Related Topic