1

My server cant seem to run Failed opening required vendor/oyejorge/less.php/lessc.inc.php

PHP message: PHP Fatal error:  Magento\Framework\View\TemplateEngine\Php::main(): Failed opening required 'vendor/oyejorge/less.php/lessc.inc.php' (include_path='/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/vendor/magento/zendframework1/library:/home/hm3/public_html/vendor/phpunit/php-file-iterator:/home/hm3/public_html/vendor/phpunit/phpunit:/home/hm3/public_html/vendor/symfony/yaml:.:/usr/share/php') in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54" while reading response header from upstream, client: 14.173.28.183, server: 209.2*******.71, request: "GET /admin HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "209.2*******.71"
2016/11/26 09:34:04 [error] 2629#2629: *3 FastCGI sent in stderr: "PHP message: PHP Warning:  Uncaught Exception: Warning: require_once(vendor/oyejorge/less.php/lessc.inc.php): failed to open stream: No such file or directory in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54 in /home/hm3/public_html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml(54): Magento\Framework\App\ErrorHandler->handler(2, 'require_once(ve...', '/home/hm3/...', 54, Array)
#1 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml(54): require_once()
#2 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/header.phtml(19): include('/home/hm3/...')
#3 /home/hm3/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/home/hm3/...')
#4 /home/hm3/public_html/vendor/mag...
PHP message: PHP Fatal error:  Magento\Framework\View\TemplateEngine\Php::main(): Failed opening required 'vendor/oyejorge/less.php/lessc.inc.php' (include_path='/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/vendor/magento/zendframework1/library:/home/hm3/public_html/vendor/phpunit/php-file-iterator:/home/hm3/public_html/vendor/phpunit/phpunit:/home/hm3/public_html/vendor/symfony/yaml:.:/usr/share/php') in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54" while reading response header from upstream, client: 14.173.28.183, server: 209.2*******.71, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "209.2*******.71", referrer: "http://209.2*******.71/admin"

2 Answers 2

2

I had the same issue with another SM theme, after setting Apache's root folder to /pub instead of the Magento root.

The problem is that compile_less.phtml is including file using require. The one reported in the exception message, vendor/oyejorge/less.php/lessc.inc.php, is only the first:

require_once ("vendor/oyejorge/less.php/lessc.inc.php");

That, and the following require calls, should be fixed to use an absolute path instead of a relative one:

require_once (BP."/vendor/oyejorge/less.php/lessc.inc.php");

This should make your theme and website work but bear in mind that what happens in that compile_less.phtml file goes against all Magento 2 best practices. So my advice is to get rid of that file and refactor the theme or buy a better theme.

2

For Maagento 2.3.3.

$root_path = BP . '/';
require_once($root_path . "vendor/wikimedia/less.php/lessc.inc.php");

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.