asehgal asehgal - 1 year ago 86
PHP Question

php script does not run when called from bash script on MAC OS X

Following is a bash script

that I am trying to use to call a PHP script

# Main script

php -f generateTest.php

Why does this not run when I "double click" the bash script ? It runs on calling from the
on OS X

I get the error message

asehgal-MacBook-Pro:~ asehgal$ /Users/asehgal/projects/configtest/run.command ; exit;
Could not open input file: generateTest.php
Saving session...
...copying shared history...
...saving history...truncating history files...

I have used
chmod +x
to make it executable.

Answer Source

Use the absolute path to your generateTest.php file and it should work, it's not working now because it's trying to find generateTest.php in your current working directory (where you are running run.command from)


# Main script 

php -f /Users/asehgal/projects/configtest/generateTest.php
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download