Mac Discussion

Get help with your Mac hardware and software. Discuss Apple and its products.

[Advanced]
Jump To:

Goto Thread: PreviousNext
Is there a way to save a PHP command in Terminal so it'll auto-load?
Posted by: Eric (IP Logged)
Date: November 5, 2009 11:01AM

I have a PHP script that I use via Terminal to download and format a large amount of data as an Excel file.

Currently, I open Terminal, enter "PHP ", drag my .php file into the window and hit ENTER. Is there a way to set it up so that all I have to do is click on one item and it'll auto load the "PHP " and file location?

Thanks!

Re: Is there a way to save a PHP command in Terminal so it'll auto-load?
Posted by: Eric (IP Logged)
Date: November 5, 2009 02:53PM

Figured it out. Saved the command in the Terminal prefs and set it to run upon launch.

Re: Is there a way to save a PHP command in Terminal so it'll auto-load?
Posted by: Joe Moon (IP Logged)
Date: November 5, 2009 03:03PM

There's another way to do this.
1. Edit the .php file (let's call it my.php), and add #!/usr/bin/php as the first line
2. Rename my.php to my.command (in terminal: mv my.php my.command)

Double-clicking on the my.command file will now open a shell window and run your php script.



Sorry, only registered users may post in this forum. Click here to register now.
Page creation time: 1258794973.7 sec.