Results 1 to 3 of 3

Thread: Can't run php script from root directory

  1. #1
    Join Date
    May 2008
    Beans
    19

    Unhappy Can't run php script from root directory

    I have a php script called hellaVCR. Its in my /var/www/hellaVCR directory.

    The only way I can get the script to run correctly is to be IN the directory. For example:

    Code:
    ryan@rkoffice:/$ php /var/www/hellaVCR/hellavcr.php 
    [10/01/08 06:54:52] processing tv...
    ryan@rkoffice:/$
    It doesn't run correctly.

    BUT if im IN the directory before I run the script, it works fine...
    Code:
    ryan@rkoffice:/$ cd /var/www/hellaVCR
    ryan@rkoffice:/var/www/hellaVCR$ php /var/www/hellaVCR/hellavcr.php [10/01/08 06:55:44] processing tv...
    [10/01/08 06:55:44] House (x264, English)
    [10/01/08 06:55:44]   last episode: 5x03
    [10/01/08 06:55:58] saving xml file | done
    ryan@rkoffice:/var/www/hellaVCR$

    I'm ultimately needing to setup as a cron, but I figure I need to get it working in terminal first.

  2. #2
    Join Date
    May 2007
    Location
    UK near Bedford
    Beans
    3,483
    Distro
    Ubuntu Development Release

    Re: Can't run php script from root directory

    Its worth checking that you have no statements in your script that are assuming a path to a file. When you change the point where you run the script from you may be changing the default path.
    PC

    To get a terminal command to put its output into a file use this format
    {terminal command} > {filename}

  3. #3
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Can't run php script from root directory

    Code:
    sudo apt-get install php5-cli

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •