PHP via CLI on WampServer

Discussion in 'Apache' started by vineld, Apr 17, 2012.

  1. #1
    I would like to run a php script through the CLI prompt on a WampServer installation on Windows 7. The problem here is that there are many files included in the script in 2-3 levels and my requires are sometimes using relative paths which do not work using CLI.

    Is there any way to solve this issue?
     
    vineld, Apr 17, 2012 IP
  2. blacknet

    blacknet Active Member

    Messages:
    709
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    70
    #2
    strange, relative paths may be using the wrong directory separator, swapping "egg/foo.php" for "egg".DIRECTORY_SEPARATOR","foo.php" would be good practise and most likely solve this.

    similarly, not using ".." and instead using dirname(__FILE__) - where dirname is repeated once for each level up you need to go - would help.
     
    blacknet, Apr 17, 2012 IP