CGI Timeout

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

User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Oh, that's easy. Just add PHP's bin to your PATH variable and then invoke scripts like this from cmd.exe:

Code: Select all

php maintenance-script.php
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

I guess my question should be, how to enable CLI, so that I can run scripts via cmd.exe in windows.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

My Computers > Properties > Advanced > Environment Variables

Find "Path" and add the path to your PHP installation to the end (prepend a semicolon if necessary).

Boot up cmd.exe using "Run..." and then type `php -v` to see if it works.
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

I get this error....
'php' is not recognized as an internal or external command,
operable program or batch file.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Can you copypaste your path here?
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

C:\php;C:\Inetpub\wwwroot\ratan_dev\FinancialReports;
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Try cd'ing into C:\php and then try `php -v`again. That path should work. Also, try closing and reopening cmd.exe
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

Same error. I had installed php using installer and then extracted files from ext folder of binary installation and put them into c:\php. I had a very difficult time to set up php and somehow this worked.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

How peculiar. Is there a file C:\php\php.exe?
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

nope. I have php-cgi. Its an application file. Not sure if this helps. I really appreciate your help.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Okay. Go to http://php.net/ and download a zipped file of the PHP binaries (make sure they're the same version as the version you have installed, you may have to dig around to find them). Extract them, and then copy ONLY php.exe to C:\php\
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

okay...works now
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

I have executed my script from the cmd. hopefully this should not timeout / expire. I appreciate your help. I was almost about to switch my framework because of that. Thanks again!!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Good luck. If it times out, it's definitely PHP, set_time_limit(0) should fix it.
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

yep..thx
Post Reply