0

I was working on migrating a web server, and one of the back end script is not executing properly from cron. So I manually attempted to execute the php script, and instead of executing it, the scripted was printed to the console. The permission is set to 777.

[root@hostname]#    php script.php
<?
$log->LogStart();
.........
.....
......
?>
2
  • 2
    Use <?php instead of <?? Commented May 14, 2014 at 21:51
  • 1
    If you are using the php CLI command, the script doesn't need to be executable. It could just be 0644. Commented May 14, 2014 at 21:52

1 Answer 1

2

HamZa is spot on in his comment. Use the full open tag <?php in stead of the short open tag <?.

You have allowed for short open tags in your php.ini, but when calling php from the command line, that php.ini is not used. (You can point to that php.ini by supplying an parameter with your call.)

With the short open tags not allowed, php parses the <? as regular 'html', and echoes it out.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.