Why doesn't PHP parse my scripts?

I'm trying to get the php executable to parse scripts, but it doesn't work. I am running something like this:

php c: \ test.php

and test.php contains the following:

<?
echo 'hello!';
?>

      

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

0


a source to share


4 answers


Make sure short_open_tag is enabled in your php.ini. Otherwise use <?php

to start your script.



+3


a source


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



php -f c:\test.php

      

+1


a source


It has been a while since I ran php from the command line, but try this:

<?php
echo 'hello!';
?>

      

0


a source


Also make sure your web server is configured correctly. If it is not configured to run .php pages through a php interpreter, it can just appear as a text file.

0


a source







All Articles