Jump to content

Execution of a PHP code takes too long


marz

Recommended Posts

:D 100% SUCCESS  ::)

 

1) I solved the problem with the comman line scripting by creating a text file, wrote the commands as if written from the CMD, saved it and renamed it .bat so as it auto executes when doubleclicked.  This also solved the problem that output scriptfile was not created from the icon/target method. With the .bat method, the scriptfile was created.

 

2) The resulting .html output was 3MB long with full text output and 450kb long when text output was stripped to bear minimum. In both cases, when visualising the html from IE7, the browser froze (I was surprised that 450Kb was too much to handle! So I simply loaded the html file in Ultraedit, and viewed as html. It opened and showed successufully both the 3000kb and 450kb html files

 

 

I learned so much from the post/forum and hope this helps other coders who encounter this problem. I seen a number of posts related with thesame problem and remained as unsolved.

 

Thannjs

Link to comment
Share on other sites

A kind of miracle took place - the script is running very fast on Internet Explorer. I have edited the script (actually made it longer) to include the option verbose mode (were there is all printing) and quite mode (bare essentials are printed) by including an if in every print function.

 

I have the suspect that the PHPRC variable was the culprit of this problem. Since it was in the env paths, and I installed the new PHP5.3 in a different folder, the old php installation did not uninstalled successfully. Before removing the variable pathe from the Environments, the old php dir could not be deleted.

 

The script in quite mode executes to the very end in 2mins (and I have a sleep(0.1); function in the routine) while the verbose mode takes 3mins, but when it reaches almost the very end, it freezes (probably due to overflow of text output)

 

Would be nice if you comment about all this as I do not believe in miracles!

 

previous php version was 5.22

 

In any case, it was great to learn

 

 

Link to comment
Share on other sites

I ran it from command line and worked perfectly (see previous posts). However it is somehow convenient to run it from browser (you are just an F12 or F5) away for testing purposes.  As I said, all of a sudden it is running fast and almost flawless from the browser now.  I just wish to know what could have been the culprit.

 

Thanks for the sleep (0.1) = Sleep (1) - didn't know that

 

 

Link to comment
Share on other sites

I'm also pretty sure that the script was executing correctly to the end. It was browser that would probably reset the connection.

 

As far as testing command line scripts, if you use an IDE you're usually an F6 away from running your script, and from the console - up-arrow away.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.