简体   繁体   中英

PHP script not running in Command Prompt Windows 7

I am currently working on a Twitter project to collect all the tweets from Twitter so i decided to use Streaming API. I referred from this link and followed the steps. I would also like to use AlwaysUp Windows Service instead of *nix server to run get_tweets.php and parse_tweets.php continuously in the background.

However, when I tried to run get_tweets.php in the command prompt by typing:

C:\php\php.exe C:\www\140dev\db\get_tweets.php

the command prompt did not show any results or errors. When I run parse_tweets.php in command line, it has no results and errors too, but it states

Administrator: Command Prompt - C:\php\php.exe C:\www\140dev\db\parse_tweets.php

on the title bar of the command prompt. (I believe this is running parse_tweets.php successfully because the script can be run continuously in AlwaysUp Service too, which is what I want.)

On the other hand, get_tweets.php did not display the path of the script on the title bar. I tried to run it in AlwaysUp Service but it stopped automatically after a few seconds. I checked the event log and it only states that the get_tweets application entered in a stop state. Wondering if any kind souls can enlighten me or any reference for me to guide? Thank you in advance.

Note: I use Apache, PHP, MySQL, and Localhost server

You should run the PHP as follow:

C:\php\php.exe -f "C:\www\140dev\db\parse_tweets.php"

Reference: http://php.net/manual/en/install.windows.commandline.php

Available command line options: http://php.net/manual/en/features.commandline.options.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM