Jump to content

Running PHP on Desktop/Command Line


mem0ri

Recommended Posts

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:

#!/usr/bin/php

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

Any thoughts?
Link to comment
Share on other sites

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:[code]chmod +x /path/to/your/script.php[/code]

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]
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.