im trying to run a php script that will work fine when i try to run it in a browser but wont recognise the include paths when i run in on the command line for some reason. (the program has to run on the command line because its part of a cron job)
heres just a simplified example of what im trying to do:
i have a file called test1.php in one directory called test1
i have another file called test2.php in another directory called test2
in test1.php i have the include path "include_once ('../test2/test2.php');
now if im right file test2.php should be included in test1.php
if i run test1.php in the browser it works fine. however, if run it on the command line using the following command: "c:\wamp\php\php.exe -c c:\wamp\apache\php.ini -q c:\wamp\www\test1\test1.php"
i get an error saying that it failed to open ../test2/test2.php in c:\wamp\www\test1\test1.php.
if i take the include path out of test1.php and run it in the command line, test1.php executes perfectly so i know its not a problem with the command im using
anyone know how to fix this??? im using windows, dunno if that effects include paths or not...
include paths
Moderator: General Moderators
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
is it something that you will have to run both from the command line and the browser or just the command line in your cron job?
if it is just part of the cron job you should be able to
if it is just part of the cron job you should be able to
Code: Select all
include('c:\wamp\www\test2\test2.php')
Last edited by phpScott on Tue Apr 26, 2005 6:14 am, edited 1 time in total.
-
dannymc1983
- Forum Commoner
- Posts: 80
- Joined: Wed Feb 16, 2005 7:24 am