0

I'm not sure what i'm doing wrong here. I've set up the environment variables... and i can do php -v and it'll show me the version. However, if i do php blah.php to run a php script i've written, the console returns with no errors and the script is not run? I know this script works, because i made it a long time ago when i first worked with PHP - however, i don't remember PHP or anything about it at the moment.

does it have something to do with SET PATH? I don't see a .bat file in the PHP folder though. Yet, it seems to be working fine when i run php -v... so confused...

Help? How do i run this script?

1
  • make sure you have errors enabled in your CLI config. Without any sort of output it's hard to tell what the problem is.
    – Ben Rowe
    Commented Mar 12, 2012 at 3:04

2 Answers 2

2

You should use the -f option to execute a file

php -f blah.php

It may also be useful to read the help

php -h
3
  • I was too slow! While I was off figuring this out, you got it. :-)
    – TecBrat
    Commented Mar 12, 2012 at 3:01
  • hmm i've tried that.. but doesn't seem to want to run it... perhaps i've messed something else up.. thanks anyway +1
    – BigBug
    Commented Mar 12, 2012 at 3:03
  • did you double check the path to blah? maybe php -f /home/username/public_html/blah.php or php -f /home/username/blah.php Just a guess since I work out of user folders a lot, maybe you do too. :-)
    – TecBrat
    Commented Mar 12, 2012 at 3:11
1

try

php -f blah.php

From php -h

-f Parse and execute <file>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.