relative filenames in scripts

Post your support requests/solutions for phpJobScheduler [website]
jude.hanlon
Seems to be staying... Lets see...
Seems to be staying... Lets see...
Posts: 3
Joined: Wed Dec 29, 2004 6:02 am
Contact:

relative filenames in scripts

Postby jude.hanlon » Mon Mar 28, 2011 2:32 pm

The scripts that I'm running using phpscheduler would ideally use a common script to access the database, but both relative and absolute pathnames aren't recognised: I get...

Code: Select all

Warning: require(../../jude/admin/vars2.php) [function.require]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\jude\appointments\requester-export.php on line 4

Fatal error: require() [function.require]: Failed opening required '../../jude/admin/vars2.php' (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\jude\appointments\requester-export.php on line 4

I've tried several permutations, but each time no joy.
phpscheduler is in the root directory
the script is in /jude/appointments/export-requesters.php
the common access file settings are in /jude/admin/vars2.php (as above)

As a short-term fix I've included the DB access info in each file, but I'd prefer to use the relative pathnames if poss so that when copying from test to live I don't have to change/check each file for such mundane info...

Any ideas?
thanks!
jude

davidgwalker
MODS thats what I do that is! But definately NO mod music! It has to be ROCK!
Posts: 1807
Joined: Mon Oct 25, 2004 8:20 pm
Location: Huddersfield, UK
Contact:

Re: relative filenames in scripts

Postby davidgwalker » Mon Mar 28, 2011 2:47 pm

Hi Jude,

If you add it as a remote script does it fire?

More details here:
viewtopic.php?f=1&t=579

Cheers

Dave

jude.hanlon
Seems to be staying... Lets see...
Seems to be staying... Lets see...
Posts: 3
Joined: Wed Dec 29, 2004 6:02 am
Contact:

Re: relative filenames in scripts

Postby jude.hanlon » Tue Mar 29, 2011 7:32 am

Hi Dave

The script itself fires, but required files within the script can't be accessed, according to the error message.

The first few lines of the script are...

Code: Select all

<?php
session_start();
require '../../jude/admin/vars2.php';

$filename="requester-list.csv";
$outfile=fopen($filename,"w");


...and it falls over with the error message I previously posted at line 3
this file is in /jude/comps
phpscheduler is in /phpjobscheduler
the file I want to "require" is in /jude/admin

the path is currently set as though the working directory is phpjobscheduler/pjsfiles, which is my current best guess at getting this working as the error message is at least showing me the correct filepath even though it's saying it can't find/open the file...

cheers
jude

davidgwalker
MODS thats what I do that is! But definately NO mod music! It has to be ROCK!
Posts: 1807
Joined: Mon Oct 25, 2004 8:20 pm
Location: Huddersfield, UK
Contact:

Re: relative filenames in scripts

Postby davidgwalker » Tue Mar 29, 2011 7:43 am

Try this:

Code: Select all

<?php
session_start();
chdir("../../jude/admin/");
require 'vars2.php';
...


Return to “phpJobScheduler [forum]”

Who is online

Users browsing this forum: No registered users and 1 guest