Kirby Software Forum
May 19, 2013, 05:19:39 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Moved to new web hosting company
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Run a program  (Read 2170 times)
Anonymous
Guest
« on: July 19, 2005, 03:20:09 AM »

I have Windows 2003 Server and IIS6. I have created a batch file for Kirby Alarm that will run a php program once every day.
 
The Kirby Alarm program entry is: c:import.bat
 
The program "import.bat" has one line:
"c:phpphp.exe" c:import.php
 
It doesn't seem to work when I test it in Kirby Alarm, but if I run the import.php program from the IE browser, it does work. It is importing a comma delimited text file into a MySQL database.
 
I would appreciate any help.
 
Thanks, LanC
Logged
Ian Cook
Administrator
Hero Member
*****
Posts: 846



WWW
« Reply #1 on: July 19, 2005, 10:38:05 AM »

What happens when you run it from the command line.
ie from the dos prompt enter c:phpphp.exe c:import.php
 
If that works then it should work in kirby alarm and you won't have to use the batch file either.
If it doesn't work then the problem is somewhere else other than Kirby Alarm.
 
The other thing to check is the working directory correct?
 
I'm interested to find out how you get on.
 
Thanks
Ian Smiley
Logged
LanC
Guest
« Reply #2 on: July 20, 2005, 04:06:42 AM »

Thanks Ian.
 
The dos entry did not work with or without the batch file.
 
The working directory looks okay.
 
It strange that it would work through the browser but not Kirby Alarm or the dos promt. That probably tells me something. I just don't know what.
 
I'll keep digging.
 
Lan
Logged
Ian Cook
Administrator
Hero Member
*****
Posts: 846



WWW
« Reply #3 on: July 20, 2005, 04:27:42 AM »

Hi,
Good, that has established something. ie the php script can only run from your browser.
 
The next thing I would try is to get Kirby Alarm to call the php script from within your browser.
 
So...in the program section of kirby alarm enter your browser path and the php script.
eg "C:Program FilesInternet ExplorerIEXPLORE.EXE" c:import.php
(Don't forget to include the quotes)
 
This will load internet explorer with your script.
Unfortunately it will also mean the browser will be left running. You will need to find another way to close it.
 
Ian
Logged
Ian Cook
Administrator
Hero Member
*****
Posts: 846



WWW
« Reply #4 on: July 20, 2005, 06:29:45 AM »

Hi Lan,
I was just checking out the php web site for the command line interface
http://au3.php.net/manual/en/features.commandline.php
 
Anyways, someone else posted this message that may be of help.
Quote
This one took me all morning to finally figure out. My problem was that I needed to run a PHP script via command line in the background. I have my script run automatically every 15 seconds.
 
I am running Apache 2 on Windows XP Pro with PHP 4.3.11. I am also connecting to a MySQL database.
 
 I was calling my script like this:
 
c:phpcliphp.exe d:webservermysitescript.php?foo=bar
 
And I was accessing my GET parameters via $_GET. Well, calling it this way was giving me a "Input file not specified" error message. I could not understand why. I was able to run another script just fine like this:
 
c:phpcliphp.exe d:webserverscript.php
 
As it turns out, attempting to pass parameters through the GET method renders the file name invalid to php.exe. So, to fix my problem, I realized I need to call my script and parameters like this:
 
c:phpcliphp.exe d:webservermysitescript.php bar
 
And in my script, I can see bar like this:
 
$argv[1] // grab [1] because
  • holds the script name

That solved my problem! I HOPE this helps someone else in the future!

 
There were lots of other good contributions. Perhaps once of those may help you.
 
Kind regards
Ian
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!