views:

82

answers:

4

I'm trying to get the php executable to parse scripts, but it's not working. i run something like this:

php c:\test.php

and test.php contains this:

<?
echo 'hello!';
?>

and that is exactly what running the command returns. It returns the raw code. How can I get it to actually parse the code and return "hello!" instead?

+3  A: 

Make sure you have the short_open_tag setting enabled in your php.ini. Failing that, use the ever-so-slightly longer <?php to start your script.

Paul Dixon
A: 

It's been a while since I've ran php off the command line, but try this:

<?php
echo 'hello!';
?>
Unknown
A: 

Also make sure that your webserver is correctly configured. If it is not configured to run .php pages through the php interpreter it may simply display as a text file.

Toby Allen
+1  A: 

Another option might be to try using the -f command line option.

php -f c:\test.php
Alo