Reputation: 133
I am using wkhtmltopdf to export pdf and it works fine when I try to export the pdf localy or from a an other machine in the same network but when i Try to export the pdf from an other pc not from the same network I get this error message
FatalErrorException in WindowsPipes.php line 207:
Maximum execution time of 30 seconds exceeded
Upvotes: 0
Views: 4941
Reputation: 167
In some cases this slowness is caused by some missing items, like: images, fonts and links.
Try to check if some images are pointing to invalid path.
Upvotes: 0
Reputation:
This is to make sure a bad script don't consume too much resource. To allow your PHP script to run at a longer time, you'll need to increase the maximum execution time limit of PHP scripts using any of the following methods; - See more at: https://www.simplified.guide/php/increase-max-execution-time
Edit your php.ini file and find this line:
max_execution_time
Change its value to 300:
max_execution_time = 300
Else, you need to add this line at the head of you php page :
ini_set('max_execution_time', 300); //seconds
Upvotes: 1
Reputation: 3721
The problem you mentioned has nothing to do with PHP's max_execution_time
ini parameter.
By looking at the tags you have added to your question it seems that you are using the PHP Laravel framework. You are probably using a PHP library which uses wkhtmltopdf
to generate a PDF (eg. from a HTML content), i.e. KnpLabs/KnpSnappyBundle.
Such a library does not use exec function, which would block the PHP script until either it's done in timely fashion or the max_execution_time is exceeded. Instead it uses the proc_open function which would execute the wkhtmltopdf
command and open file pointers for input/output and thus return immediately (so the max_execution_time
would not be in effect).
If that's the case then the cause of your Maximum execution time of 30 seconds exceeded
is strictly related to the library you are using.
If your library are using a process-driven class for executing the wkhtmltopdf
command then the issue you are describing might share the same cause like the one described by the people using the KnpSnappy library. If that's the case then please check these links, it might help:
In my case the problem was related to the PHP session and the cookie
argument, so I configured my library such that I passed the --cookie
argument to the wkhtmltopdf
command. Check the wkhtmltopdf manual for more info.
Upvotes: 0
Reputation: 2188
The most preferable way to do this so you don't have to add it to add those codes to all the pages. Go to your php.ini
in C://xampp/php/php.ini
and go to the line that looks like this max_execution_time = 30
you the change the value to the desired amount of seconds you like save it and restart your XAMPP server
Upvotes: 0
Reputation: 2168
You have to maximize your execution time.
if you are working on Live server than make a file named as user.ini and write following code. (save user.ini file in same folder)
max_execution_time = 600 // 600 seconds
if you are working on localhost then you can use ini_set() function like this ,
ini_set('max_execution_time', 600); //600 seconds
Upvotes: 0
Reputation: 4637
Your loop might be endless. You need to add this at the top of the php page
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
else add this line
ini_set('max_execution_time', 0);
Upvotes: 0