You are not logged in.
Pages: 1
I'm trying to develop a non-web based PHP script. I don't want to install a webserver, I just want the PHP CLI so that I can run what scripts I write. I installed the "php" package, but it doesn't seem to do anything.
If I call php with either "php myfile.php" or "php -f myfile.php" it just echoes the file back to me. If I run the "php" command by itself it just sits there accepting input and doesn't do anything with it (no errors no execution no anything). Is "php" the right package here? If I type "man php" it describes itself as the PHP CLI...
Offline
Did you surround your code with <?php ?> tags? I think they are still needed to let the php interpreter know that what follows is php code.
Offline
Did you surround your code with <?php ?> tags? I think they are still needed to let the php interpreter know that what follows is php code.
The alternative would be to run
php -r myscript.php
Which would negate the need for the <?php ?> tags.
Offline
If I run the "php" command by itself it just sits there accepting input and doesn't do anything with it (no errors no execution no anything). Is "php" the right package here? If I type "man php" it describes itself as the PHP CLI...
Sorry, can't edit my post above, change of nick..
If you run a command by hand from the CLI you would need to press ctl+d to have it interpreted. Of course, without the -r you would still need the php tags, even when writing your script by hand.
Example
# php
<?php echo "foo\n"; ?>
followed by a control+d will output "foo"
Offline
Pages: 1