Dompdf Failed to open stream lib fonts Permission on Laravel - laravel-5

I created laravel project that work fine on my local windows pc. Once I upload to Centos7 server(via SSH). I have problem on dompdf file export. I got an error 'fopen(/var/www/html/srp/vendor/dompdf/dompdf/lib/fonts/1efc692e8d059670778f16e902f6d711.ufm): failed to open stream: Permission denied'. Picture of errror https://ibb.co/ZShGG2X
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'fopen(/var/www/...', '/var/www/html/s...', 45, Array)
#1 /var/www/html/srp/vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php(45): fopen('/var/www/html/s...', 'w+')
#2 /var/www/html/srp/vendor/phenx/php-font-lib/src/FontLib/TrueType/File.php(361): FontLib\AdobeFontMetrics->write('/var/www/html/s...', NULL)
#3 /var/www/html/srp/vendor/dompdf/dompdf/src/FontMetrics.php(212): FontLib\TrueType\File->saveAdobeFontMetrics('/var/www/html/s...')
#4 /var/www/html/srp/vendor/dompdf/dompdf/src/Css/Stylesheet.php(1537): Dompdf\FontMetrics->registerFont(Array, 'http://110.49.7...', NULL)
Thank you for all advice.

Related

How to resolve error on ProcessMaker 4.3.0 instllation?

My server specifications:
Centos 7.9
PHP 8.2
Nginx
MySQL 8.0
Composer 2.4.4
Node 16.18.1
NPM 8.19.3
Redis 5
Docker
I have installed all the dependencies required for ProcessMaker 4.3.0 running(mentioned the versions above). After enabling the npm, laravel and artisan horizan server, I hit the URL and get 500 error. On checking the nginx log I get the following error:
[error] 8150#8150: *512 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/opt/processmaker-4.3.0/storage/framework/views/ef0f3565ae74afa67f42e441ee3da8cfbe934ae1.php): Failed to open stream: Permission denied in /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(187): file_put_contents() #2 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(169): Illuminate\Filesystem\Filesystem->put() #3 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(55): Illuminate\View\Compilers\BladeCompiler->compile() #4 /opt/processmaker-4.3.0/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get() #5 /opt/processmaker-4.3.0/vendor/laravel/fram...PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/opt/processmaker-4.3.0/storage/framework/views/ef0f3565ae74afa67f42e441ee3da8cfbe934ae1.php): Failed to open stream: Permission denied in /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(187): file_put_contents() #2 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(169): Illuminate\Filesystem\Filesystem->put() #3 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(55): Illuminate\View\Compilers\BladeCompiler->compile() #4 /opt/processmaker-4.3.0/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get
I have already given 755 permission to the storage and vendor folder in processmaker. Also the owner ship and group of all the folders and files is nginx.
Whatelse, could I be missing out?

Why do I get an error in laravel 8 log but not in browser

I normally duplicate a project to start a new one. In the browser, there is no error. The page displays properly. In Laravel log I get the following error, although the file fn_table.php is there. If I remove the file, I get an error in the browser.
[2021-08-27 09:55:45] local.ERROR: include_once(public/fn/fn_table.php): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): include_once(public/fn/fn_table.php): Failed to open stream: No such file or directory at /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php:12)
[stacktrace]
#0 /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php(12): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'include_once(pu...', '/Users/paul/Web...', 12)
#1 /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php(12): include_once()
#2 /Users/paul/WebSites/MeerkatSafaris/vendor/composer/ClassLoader.php(480): include('/Users/paul/Web...')
#3 /Users/paul/WebSites/MeerkatSafaris/vendor/composer/ClassLoader.php(346): Composer\\Autoload\\includeFile('/Users/paul/Web...')
#4 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(735): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#5 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(669): Illuminate\\Foundation\\Application->resolveProvider('App\\\\Providers\\\\A...')
#6 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register('App\\\\Providers\\\\A...')
#7 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(649): Illuminate\\Foundation\\ProviderRepository->load(Array)
#8 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#9 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#10 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#11 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#12 Command line code(1): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#13 {main}
What is happening?
In fact these errors are all over my project.
I learned how to create a file with global functions by listing their path in the autoload varibale in the composer.json. This is ok for functions used all over the project.
However, it happens that I need some global functions only in some controllers. I normally use php include_once which works 100% but generates the above error in the log.
What is the way around that?
And why is the laravel log reports an error on a file which is there?

Laravel: symlink(): Permission denied on centos how to fix?

I am installing a project made in laravel on a server with a CENTOS 7.9 vmware [cpnael] v94.0.8 operating system, modify the permissions I needed to operate the project.
When I run the project I get the present error:
[2021-05-10 16:26:39] production.ERROR: symlink(): Permission denied {"exception":"[object] (ErrorException(code: 0): symlink(): Permission denied at /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:315)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'symlink(): Perm...', '/home/cbdev/pub...', 315, Array)
#1 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(315): symlink('/home/cbdev/pub...', '/home/cbdev/pub...')
#2 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php(45): Illuminate\\Filesystem\\Filesystem->link('/home/cbdev/pub...', '/home/cbdev/pub...')
#3 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Foundation\\Console\\StorageLinkCommand->handle()
#4 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#5 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#6 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#7 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/Container.php(611): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#8 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call(Array)
How can I solve this problem?
use this command php artisan storage:link
If php artisan storage:link does not help, it can happen that your hosting does not allow you to make symlinks with a command.
Try to contact the support of your hosting if this is the case, or try to make the symlink manually using midnight commander (use the command mc in the ssh of the webserver then create the symlink between public storage and storage/app/public) ,
or with the ln linux command (https://linuxize.com/post/how-to-create-symbolic-links-in-linux-using-the-ln-command/).

Laravel Failed to open stream: Permission denied for Dompdf lib fonts permission on CentOs7

I created laravel project that work fine on my local windows pc. Once I upload to Centos7 server(via SSH). I have problem on dompdf file export. I got an error
'fopen(/var/www/html/srp/vendor/dompdf/dompdf/lib/fonts/1efc692e8d059670778f16e902f6d711.ufm): failed to open stream: Permission denied'. Picture of errror https://ibb.co/ZShGG2X
This is error message grabbed from laravel.log
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'fopen(/var/www/...', '/var/www/html/s...', 45, Array)
#1 /var/www/html/srp/vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php(45): fopen('/var/www/html/s...', 'w+')
#2 /var/www/html/srp/vendor/phenx/php-font-lib/src/FontLib/TrueType/File.php(361): FontLib\AdobeFontMetrics->write('/var/www/html/s...', NULL)
#3 /var/www/html/srp/vendor/dompdf/dompdf/src/FontMetrics.php(212): FontLib\TrueType\File->saveAdobeFontMetrics('/var/www/html/s...')
#4 /var/www/html/srp/vendor/dompdf/dompdf/src/Css/Stylesheet.php(1537): Dompdf\FontMetrics->registerFont(Array, 'http://110.49.7...', NULL)
#5 /var/www/html/srp/vendor/dompdf/dompdf/src/Css/Stylesheet.php(1376): Dompdf\Css\Stylesheet->_parse_font_face('font-family: 'T...')
#6 /var/www/html/srp/vendor/dompdf/dompdf/src/Css/Stylesheet.php(329): Dompdf\Css\Stylesheet->_parse_css('#font-face {\n\t ...')
#7 /var/www/html/srp/vendor/dompdf/dompdf/src/Dompdf.php(650): Dompdf\Css\Stylesheet->load_css('\n\t\t#font-face {...', 3)
Much appreciated for all advice, Thanks.

Magento Warning Error in loading from Autoload.php on line 93

Please check I am migrating a Magento website to my local XAMPP and I am getting below Warning.
I did not find the file Mage\Core\Controller\Varien\Action.php
Warning: include(Mage\Core\Controller\Varien\Action.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\agandearth.com.au\lib\Varien\Autoload.php on line 93
#0 C:\xampp\htdocs\agandearth.com.au\lib\Varien\Autoload.php(93): mageCoreErrorHandler(2, 'include(Mage\Co...', 'C:\xampp\htdocs...', 93, Array)
#1 C:\xampp\htdocs\agandearth.com.au\lib\Varien\Autoload.php(93): Varien_Autoload::autoload()
#2 [internal function]: Varien_Autoload->autoload('Mage_Core_Contr...')
#3 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Controller\Front\Action.php(35): spl_autoload_call('Mage_Core_Contr...')
#4 C:\xampp\htdocs\agandearth.com.au\lib\Varien\Autoload.php(93): include('C:\xampp\htdocs...')
#5 [internal function]: Varien_Autoload->autoload('Mage_Core_Contr...')
#6 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Cms\controllers\IndexController.php(36): spl_autoload_call('Mage_Core_Contr...')
#7 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(337): include('C:\xampp\htdocs...')
#8 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(308): Mage_Core_Controller_Varien_Router_Standard->_includeControllerClass('C:\xampp\htdocs...', 'Mage_Cms_IndexC...')
#9 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(196): Mage_Core_Controller_Varien_Router_Standard->_validateControllerClassName('Mage_Cms', 'index')
#10 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 C:\xampp\htdocs\agandearth.com.au\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#12 C:\xampp\htdocs\agandearth.com.au\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#13 C:\xampp\htdocs\agandearth.com.au\index.php(91): Mage::run('', 'store')
#14 {main}
I did not find the file Mage\Core\Controller\Varien\Action.php
app\code\core\Mage\Core\Controller\Varien\Action.php - a file that should not be missing in any Magento install I've ever worked with.
If it exists on the working website and not on your XAMPP website, then your transfer method failed. This is quite common with (s)ftp transfers and Magento Connect install/upgrade(s), you have to run them multiple times until everything actually is present.
If you are going to do a file by file transfer, you are better off using rsync as it will do a synchronization transfer that allows for recovery from partial transfers by only copying over what is missing on subsequent runs.
It is often better to create a compressed tar archive of the live server document root, transfer that and dearchive it on your server you are transferring to. This guarantees:
you get all the files on the running installation
are able to restore all the files from the running installation to the new installation
get a warning if the archive is corrupted so you aren't wasting time with trying to make a partial Magento install to run

Resources