0

I'm unable to execute php scripts from command line. I have the following simple code in a file named test.php:

#!/usr/bin/php
print password_hash("rasmuslerdorf", PASSWORD_DEFAULT)."\n";

On executing, I get this:

#./test.php
print password_hash("rasmuslerdorf", PASSWORD_DEFAULT)."\n";

About my environment, it's a Debian 7 x64 server.

#which -a php
/usr/bin/php    
#`which php` -v
PHP 5.6.9-0+deb8u1 (cli) (built: Jun  5 2015 11:03:27)

What could be wrong with my installation?

1 Answer 1

2

You need to encapsulate your PHP code with the proper tags else it will be interpreted as plain text. Modify your PHP file to the following:

 <?php
      print password_hash("rasmuslerdorf",PASSWORD_DEFAULT)."\n";
 ?>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.