Laravel- Dompdf Maximum execution time of 60 seconds exceeded - laravel

Here is error when i convert pdf, it's not working since i run my laravel project by "php artisan serve --port=1000". But if i run my laravel project with xampp. it's alright. I don't know why?. Give me explaination and repairs . Thank you
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Maximum execution time of 60 seconds exceeded

The laravel - dompdf does not work well with php artisan serve. You should use XAMPP or another HTTP server you like.

Increase Your time limit in your controller file.Below variable to increase your time limit.
set_time_limit(300);

For me, there were two main issues.
Using images directly: I was using images with storage_path() so, I first convert image to base64 and pass it to the blade view.
Using external CSS: I was using bootstrap as external CSS and as we don't need whole bootstrap CSS, I just copy required CSS from bootstrap and place in internally with <style>..</style>
These steps make the PDF generation process very fast.

What I found was referencing to assets via asset() helper in the PDF view was throwing timeout exceeded error, I changed it to public_path() and it started working fine.

Possible causes:
linking to external CSS - you're better off writing your css between style tags in the same file as your html
using blade templating syntax e.g. #sections #roles, etc
linking to external images
Complex table structures/layouts
...from personal experience

use public_path for your external files for exe href="{{public_path('style.css')}}"

I had the same problem and narrowed it down to linking to an image in my blade file. When I embedded the image instead as per this SO answer, it no longer timed out.

dompdf does not work on
php artisan server
You should go through xampp server.
It solved my problem

Related

Thumbnail images not showing

i will be glad if anyone can help.
code line
OUTPUT
Have you ran php artisan storage:link? This is usually what does it for me.
Laravel 5 - How to access image uploaded in storage within View?

What is the most direct way to push a site update to Laravel?

I've SSH into the server and into the Laravel folder. I updated one of the html footer files but the changes aren't reflected on the website. I feel like I probably need to recompile something.
I tried deleting and re-creating the .env file (I backed it up first).
I've tried running the following commands:
php artisan clear-compiled
php artisan optimize
php artisan cache:clear
The only way I can seem to update the site is by updating the main.min.js file, located at /laravel/public/assets/js/main.min.js which is a terrible way to update the site.
How do I force Laravel to recreate this file or recompile the site based on changes I made to html template files within the site?
What am I missing here? I don't have any Laravel experience and am trying to update this site for a client.
edit:
I think I need to clarify a bit more...
The site appears to be rendered from this file: /public/assets/js/main.min.js
Most of the site's homepage, for example, is located in this js file. But the file is minified and therefore unwieldy to edit directly.
I am assuming (and I could be completely wrong here) that the file is generated from the html files located in the Laravel folder. To support this notion, I have found html files in other directories that correspond to the html located in the main.min.js file.
My assumption is that the previous developer would update the html files and then run something to compile the site into javascript files. But maybe this has nothing to do with Laravel, per se, and more to do with some frontend framework?
Try clearing the cached views...
php artisan view:clear
Laravel assets reside in
resources/assets/js
of your root directory you can have look their
if your file main.js is build using laravel mix have a on webpack.mix.js which compiles all your files you can get idea from that. make sure to run
npm run prod
if you change any file
Hope this helps?

Annoying text every page in Laravel web app

This is driving me crazy, but for some reason I have the letters "vd" before all rendered content on each page of my site in my Laravel app. Basically the letters "vd" appear at the top of every page (website, not the actual code) before the navbar or any other content. They also appear when ever I run a php artisan command. For example
C:\Users\Thomas\Git\Webapp> php artisan view:clear
vdCompiled views cleared!
-- OR --
C:\Users\Thomas\Git\Webapp> php artisan serve
vdLaravel development server started: <http://127.0.0.1:8000>
I've checked all my views and can't find the letters "vd" anywhere, but figure it must be coming from something being processed before the view because I get it running simple "php artisan" commands.
I have also tried running the webapp from "C:\wamp\www\Webapp" using WAMP and still get the "vd" text.
Probably you have the "vd" string at the top of a bootstrap file, (config, service provider, route) before the php open tag!
Try a global search in your project and find if you have vd anywhere in your whole project. may be somewhere it can be found. try to search in index.php and bootstrap.php, server.php

How to avoid using php composer dump-autoload with laravel 4?

I have uploaded my project on a web host and I use ftp to edit my code.
The problem is that I added models using eloquent for my database and to get it work I have to download my project dans run php composer dump-autoload then re-upload. Otherwise its say class not found ... Doing this all the time is just heavy.
Is there any other solution?
My webhost does not have ssh or any thing to connect to the server. Neither I can use rsync like stuff.
Maybe I should use an other framework than laravel4 to avoid using composer?
In your case, you should add your needed autoload directory to the ClassLoader::addDirectories array under /app/start/global.php. Laravel gives multiple ways to accomplish the same thing depending on your personal needs.
You can remove or not upload the bootstrap/compiled.php file.
I'm not sure if this completely fixes your problem, because I'm not sure if dump-autoload generates multiple files.
[edit]An other approach is to work on your local machine and upload after you are finished.
I'm not sure, sometimes it works, sometimes not...
But I upload:
bootstrap/autoload.php
vendor/autoload.php
vendor/composer/*
And I don't have a bootstrap/compiled.php

Load css/js files in Laravel 4 with Composer?

I'm working on creating a new project in Laravel 4. I have a tiny bit of experience in Laravel 3, in which I got used to the assets system. I'm now having a lot of trouble figuring out how to load CSS and JS files in the new system.
I believe I should be using Composer PHP, but I'm not sure how. Where do I put the actual .css and .js files? And then how do I load them with Composer to be utilized in the Laravel project?
I know there are outside plugins like Best Asset, etc. that are written to replicate the Assets system of Laravel 3, but I was hoping to understand the new system and not have to use an outside plugin.
Any help? Thanks.
You don't need Composer for your css/js assets. You can use assets pretty much the same as with Laravel 3
You can just place them in your public folder and reference them in your views. You can use plain html, or use the HtmlBuilder: HTML::style('style.css') and HTML::script('script.js')
You must take care of case sensitive.
This class must write with uppercase.
HTML::style('style.css');
HTML::script('script.js');
Laravel stylesheets and javascript don't load for non-base routes

Resources