PHP execution time in command prompt (Win)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
burek
Forum Newbie
Posts: 6
Joined: Mon Oct 06, 2008 9:48 am

PHP execution time in command prompt (Win)

Post by burek »

Hi all,

I have a simple php script that does something like this:
-connects to a mysql db
-selects a db
-executes 1 simple sql query
-disconnects from db

when I run this script through a CLI (command line interface / dos prompt), by typing: "php myscript.php" (without quotes), everything goes ok, script successfuly finishes, but.. it takes some time (about 5-10 seconds) before the command prompt is displayed again, ready for new commands.. that means, script is executed successfuly, but the command prompt does not return immediately after that, instead it delays for some time, finally returning the prompt ready for new commands..

I thought this was maybe due to a mysql connection (closing, flushing, etc.), so I've created an exe file in Delphi, which calls this php script with "WinExec('php myscript.php');" and it returns immediately after the script successfuly executes.

I'm confused.. Why does everything work as it should, when invoking a php from another exe file, but it's not working when it is invoked from a dos prompt (I mean it works, but it has a delay after the script finishes)?

Thanks to all who can help me on this.
burek
Post Reply