0

I have a function in a script that is called if two parameters are detected and i call the script via commandline:

php index.php '2422244' 'Master chief'

My problem is the script is echoed and the function not being called. what could be the problem?

UPDATE: index.php

 <?
  if (isset($argv[1])) {
    if(isset($argv[2]) {
       $start = doSomething();
    }
  }
?>
2
  • check weather php stort tag open is enable or not in your php.ini for cli Commented Jan 14, 2016 at 8:04
  • short_open_tag = On in php.ini. Is there another reference specifically for command line? Commented Jan 14, 2016 at 8:07

2 Answers 2

1

In many cases it is caused by a missing <?php at the start of the php file.

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

3 Comments

using short tags. had set them to on in my php.ini
@user3682205 Do you have any luck not using shorttags? Maybe the configuration is not working properly for some reason
lolI cant believe it was the short tags. Had it on in php.ini
0

Adjust php index.php '2422244' 'Master chief' to php index.php 2422244 Master chief

And if you have set short tags to ON make sure you restart your server

service apache2 restart depending on the server your running

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.