command line -r not working on windows

We have a server with windows 2008 R2 with PHP5 installed. I can run php files from the command line using

php -f file.php

with no problem. However, when I try to run PHP code inline nothing happens:

php -r ‘echo “hello world”;’

Literally no output.

Do I need to configure something in php.ini to get the -r to work?

Thanks!

TYPE
php -a
(Response “Interactive mode enabled”)

TYPE:

<?php echo "Hello, world!"; ?>

HIT ENTER

TYPE: (Hold down control key) z

HIT ENTER

Have a look in your php.ini file to see if exec() is disabled.

I tried this and it worked.

I got the answer on another forum. Turns out I had to swap the quotation marks:

php -r “echo ‘Hello world’;”

Sponsor our Newsletter | Privacy Policy | Terms of Service