Click to See Complete Forum and Search --> : baffled by include_path on Windoze 98 w/ PHP 4.2.2


vtb
09-08-2002, 01:26 PM
Greetings all,

My objective is (1) to be able to move a php file from the development machine to the deployment machine without having to change the file, (2) be able to include() a file from outside the web document tree

In my previous Apache/PHP on this miserable Win 98 system, I could use the default include_path setting in php.ini, then I could include a file with its full, absolute Unix-style path, as in include ("/usr/home/my_name/my_directory/my_file.php");

(For the sake of portability to the deployment server, I have a d:\usr\home\etc\ on this machine to match my deployment environment.)

Now, the include_path wants to default to ".;c:\php4\pear", and reverts to this if I set include_path to empty string or comment out the line. This would be fine if PHP would also let me include a file with the above notation, but it won't.

The only workaround I've come up with is to call ini_set("include_path","/usr/home/my_name/my_directory") before calling include("file.php").

Has anyone else come across this, or am I overlooking something?

Thanks

GaudeamusIgitur
09-09-2002, 04:32 AM
You mean that
include_path = ".;d:\usr\home\etc\"
in the php.ini doesn't do the job?

And the incude("complete_path\phpfile.php"); doesn't work?

Weird...

vtb
09-09-2002, 10:38 AM
The absolute Windows-style path works in the include() call, but that's the Windoze notation. I'd like to be able to move the files from the Windoze to the Unix system without having to change anything, and Unix doesn't know from d:\usr\home\whatever\file.php. And yes, saying include("/usr/home/whatever/myfile.php") fails on my system.

I can set the include_path in php.ini on my machine, and that works, but I can't mess with php.ini on my (shared) server.

dotwebbie
09-09-2002, 11:29 AM
Though it's a little late now, I have had success with using /some/old/path/to/something/file.php
on Windows. As for including something outside the document tree, include("/home/me/file.ext"); I'm guessing you got an error such as this:

Warning: Failed opening '/home/you/hi.txt' for inclusion (include_path='') in /home/you/www/include.php on line 2

Correct?

vtb
09-09-2002, 11:52 AM
I've had it work, too -- before I upgraded to 4.2.2! That's my point. And yes, that's the error I get. I wonder if this isn't a wee little bug.

dotwebbie
09-09-2002, 12:06 PM
Hrm. Perhaps I should check it out on 4.2.3 now . . . Just installed the other day. As for the include path, who is your host? Do they allow you to change php configuration through .htaccess files?

vtb
09-09-2002, 12:27 PM
change php config with .htaccess? Intriguing! Where can I learn more?

Nevermind, here's an answer: http://martin.f2o.org/php/portable

My host is pair.com and they let you do just about any reasonable thing you can think of, and more. Maybe I'll give that a shot. Thanks for the tip!

dotwebbie
09-09-2002, 01:16 PM
Originally posted by vtb
change php config with .htaccess? Intriguing! Where can I learn more?

Nevermind, here's an answer: http://martin.f2o.org/php/portable

My host is pair.com and they let you do just about any reasonable thing you can think of, and more. Maybe I'll give that a shot. Thanks for the tip!

Yeah, that's one place to look. :) No problem. Glad I could be of at least a little help . . .