1

I have a php script that exports out results in excel using PHPExcel plugin. Now since the result has around 40 columns and above 15k+ rows, it seems to be taking a lot of time, which isnt a problem for me.

However what I find is that the apache server(of my WAMPserver installation) keeps crashing after certain intervals and it also slows down my machine (the script runs local to my machine).

There are 2 things I need help here 1) Stop apache server from crashing down 2) prevent PC from slowing down

I have set_time_limit(0);ini_set('memory_limit', '-1'); in my code so I have removed the restriction of the script timing out and also the memory limit imposed.

Time to export is not a factor for me...If it takes 20 mins+ to export out the result in excel also, it should be fine (though i would prefer if there is a faster alternative ;) ). Just that the script should execute without slowing my machine (so I can multitask) and apache shouldnt keep crashing

3
  • 4
    Don't run the script via Apache.... run it as a cron/scheduled task Commented Feb 14, 2013 at 8:50
  • I've seen in the php comments for set_time_limit() that you should ALSO place in in your loop, to remind php to keep going. BUT remember that once you request the page, the script will continue until complete, so refreshing 5 times, means you have 5 scripts running. Commented Feb 14, 2013 at 8:53
  • Don't use Apache, run it as normal executable. php.net/manual/en/features.commandline.php Commented Feb 14, 2013 at 8:54

1 Answer 1

2

Here are some tips which might help:

  1. Don't use Apache. Use PHP Command line interface.
  2. Compile the PHP script to an executable for faster execution.
  3. Lower the priority of Apache (or command line ) process.
  4. Consider converting the script to faster (or more stable) language (Java, C#, C++, ...)
Sign up to request clarification or add additional context in comments.

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.