Jump to content


Running PHP on Desktop/Command Line

  • Please log in to reply
2 replies to this topic

#1 mem0ri

  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 08 June 2006 - 10:13 PM

I've written a script in PHP to copy an MSAccess database file from one network location to another and then take that DB and copy rows from one table into several others...it's all just a bandaid for an ancient program that needs to be replaced...

...the problem, however, is getting this script to run off the desktop/command line. From what I've read about the PHP SAPI CLI/CGI I am able to just prepend my file with:


However...it doesn't seem to be working...

Any thoughts?

#2 Fyorl

  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 08 June 2006 - 10:53 PM

I'm assuming you're using Linux or a unix-based operating system. In which case, have you compiled PHP for your system? Did you specify CGI or CLI (I think the default's CLI) installation?

What error messages are you getting when you try to run the command?

My Linux computer runs PHP fine from the command line if I put #!/usr/bin/php but your must make sure it has executable permissions before you can run it eg:
chmod +x /path/to/your/script.php

Of course, you may not be using Linux (or a Mac) in which case putting #!/usr/bin/php will not work and you'll have to write a batch file for it. Instructions for doing that can be found [a href=\"http://uk2.php.net/manual/en/features.commandline.php\" target=\"_blank\"]here[/a]

Don't worry, the printer fairies will sort it out.

#3 mem0ri

  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 12 June 2006 - 05:54 PM

Thank you.

I actually am not using a Linux system. Our server is a Win2000 server...and the PHP script is pulling MSAccess databases from one server location to antoher and redistributing a main table through to other tables. In other words...I'm workin' with the worst I can get (Win2000 + MSAccess)!

There are no error messages that come up...simply a failure to run. I'll look into the batch file more closely. Thank you for the link...though I think I've read over that page a couple of times with no luck for myself. I think I might need to read very slowly and take very careful notes this time.

The chmod settings, however, are definitely correct :) I had that part figured.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users