0

I've made a VERY basic website which takes an array of image URLs, zips them, and returns the zip location. The problem is that the script cuts off at some point.

One of the following usually happens:

  • not all the pictures are copied
  • not all pictures are copied and the last picture has 0 file size
  • sometimes the ajax call doesn't run the error or success callback

Is this because the server is only allowing a certain amount of time for the script to execute? It does seem to work with less pictures. What can I do?

I have the following settings:

max_execution_time 10 10 max_file_uploads 20 20 max_input_nesting_level 64 64 max_input_time 10

also, set_time_limit is disabled.

I tried ini_set('max_execution_time', 300); and nothing changed

edit: Probably a REALLY stupid question, but would it change anything if I executed another PHP page after a certain amount of time if the script isn't going to finish before the limit?

6
  • 1
    look into your error log to see if there is any errors about execution time or memory getting exhausted. Search the error message on StackOverflow. If there is no results, update your question with the error message. Commented Sep 6, 2011 at 6:56
  • Where's the error log? Sorry for teh noob question. I use 000webhost, I can't find anything Commented Sep 6, 2011 at 7:01
  • The error log is the location to which PHP writes any errors that occur during script execution. Commented Sep 6, 2011 at 7:04
  • How do I view them? I'm very bad with this stuff Commented Sep 6, 2011 at 7:11
  • The same you view any other text file. If you dont have shell access on the machine, you can also try to file_get_contents the log file to display it in your browser. Commented Sep 6, 2011 at 7:17

2 Answers 2

0

We could do with looking at your code, but if it is simply a case of the script timing out, you can use this line:

set_time_limit(0);

...to remove the time limit, and allow the script to execute completely in it's own time. You should call this as soon as you have validated the request, before you start the image copy/zip process.

If you post some code in the question I will update my answer further.

Sign up to request clarification or add additional context in comments.

1 Comment

How do you mean? Is there already no time limit, or are you not allowed to set it?
0

There are two things you can try:

  1. Increase the execution time limit with set_time_limit.
  2. Run the script through php.exe (as a console script) and not through a web server; in this scenario, there is no time limit by default.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.