Re: [PHP] Include fails when ./ is in front of file name
I appreciate the help guys. I don't understand what's going on. Here's what I've tried since posting: Copied over the PHP binaries and php.ini from my old server to my new one. No luck. Copied over the phpMyAdmin from my old server to my new one. No luck. I've double-checked all permissions. Seriously, what else could there be?! I repeat: on old server, include('./file.inc.php') works FINE on new server, include('./file.inc.php') BREAKS I'm about to do a replace of ./ with but I know that's giving up! Daniel Brown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, Apr 7, 2008 at 1:05 PM, Lester Caine [EMAIL PROTECTED] wrote: People seem to be missing the point here. These are PUBLIC applications that are failing to work for Noah. He should not need to re-write PHPMyAdmin in order to get it to work? Next people will be saying that we should re-write PHP if it does not work for us. Oh, did I say that? Must not have been paying attention as I typed in words to that effect. Sorry. I'm giving steps to debug and recreate the issue, not to rewrite anyone else's code. You may have noticed where I mentioned cross-platform portability. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); That's pretty vague, Noah. Is it unable to locate the file? What's the error message you're receiving? Also, what happens if you create two simple files in the same directory like so: ?php // file1.php echo Okay.\n; ? ?php // file2.php include(dirname(__FILE__).'/file1.php'); ? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Apr 7, 2008, at 9:36 AM, Daniel Brown wrote: On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); That's pretty vague, Noah. Is it unable to locate the file? What's the error message you're receiving? It's Windows. From experience, I know that it provides little to no error reporting in some instances. For example, if you're missing a semi-colon and you have error reporting turned on, all you get is a blank page - no other info. So, odds are is that he isn't receiving an error message. ~Phil Also, what happens if you create two simple files in the same directory like so: ?php // file1.php echo Okay.\n; ? ?php // file2.php include(dirname(__FILE__).'/file1.php'); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Philip Thompson wrote: On Apr 7, 2008, at 9:36 AM, Daniel Brown wrote: On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); That's pretty vague, Noah. Is it unable to locate the file? What's the error message you're receiving? It's Windows. From experience, I know that it provides little to no error reporting in some instances. For example, if you're missing a semi-colon and you have error reporting turned on, all you get is a blank page - no other info. So, odds are is that he isn't receiving an error message. I'm not sure where you got that from, error reporting does not differ between Windows and other platforms except where platform-specific differences exist in the implementation (of which there are few). What you're experiencing is probably the effect of the display_errors configuration option. Look it up in the manual for details. To the OP: Check that your include_path contains '.', if it doesn't add it and see if that fixes your problem. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 11:20 AM, Philip Thompson [EMAIL PROTECTED] wrote: It's Windows. From experience, I know that it provides little to no error reporting in some instances. For example, if you're missing a semi-colon and you have error reporting turned on, all you get is a blank page - no other info. So, odds are is that he isn't receiving an error message. error_reporting() == error_reporting() !platform -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 11:52 AM, Wolf [EMAIL PROTECTED] wrote: Noah, Looks like you need to be deciding on whether or not you are on windoze or *Nix. If on Windoze, your include path is \ If on *Nix, your include path is / Notice the direction of the slashes and code appropriately in all locations. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm working with a Windows server and able to use ./ in all my includes. Example - require_once( ./library/urs/URS.Framework.php ); His should work fine also. -- -Dan Joseph Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] Include fails when ./ is in front of file name
Daniel Brown [EMAIL PROTECTED] wrote: On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); That's pretty vague, Noah. Is it unable to locate the file? What's the error message you're receiving? Also, what happens if you create two simple files in the same directory like so: ?php // file1.php echo Okay.\n; ? ?php // file2.php include(dirname(__FILE__).'/file1.php'); ? Noah, Looks like you need to be deciding on whether or not you are on windoze or *Nix. If on Windoze, your include path is \ If on *Nix, your include path is / Notice the direction of the slashes and code appropriately in all locations. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 11:24 AM, Stut [EMAIL PROTECTED] wrote: To the OP: Check that your include_path contains '.', if it doesn't add it and see if that fixes your problem. He has . in the include path On Sun, Apr 6, 2008 at 2:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: PHP.ini's include path is: include_path = .;.\includes;.\pear but even if it weren't, explicitly-calling ./ forces the include to the local directory. You're right to point it out that it should be included, though I've actually seen some boxes where . was not in the path. I've even seen some cases where .. was erroneously included instead. There's treachery afoot! However, take a look at his include path Noah, I see no reason why PHP's include path should have .\pear in there. Not sure about .\includes, but .\pear likely doesn't exist in every CWD/PWD (depending on your preference in system semantics) from where it's called, and the same would go for .\includes. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Daniel Brown [EMAIL PROTECTED] wrote: On Mon, Apr 7, 2008 at 11:52 AM, Wolf [EMAIL PROTECTED] wrote: Noah, Looks like you need to be deciding on whether or not you are on windoze or *Nix. If on Windoze, your include path is \ If on *Nix, your include path is / Notice the direction of the slashes and code appropriately in all locations. Actually, PHP is smart enough to allow both on Windows. Otherwise, everyone would need to update their code for each different system, which destroys PHP's cross-platform nature. -- I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving... At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder. ;) YMMV, but I always just change them to be on the safe side, but that's just how I roll... Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Wolf wrote: Daniel Brown [EMAIL PROTECTED] wrote: On Mon, Apr 7, 2008 at 11:52 AM, Wolf [EMAIL PROTECTED] wrote: Noah, Looks like you need to be deciding on whether or not you are on windoze or *Nix. If on Windoze, your include path is \ If on *Nix, your include path is / Notice the direction of the slashes and code appropriately in all locations. Actually, PHP is smart enough to allow both on Windows. Otherwise, everyone would need to update their code for each different system, which destroys PHP's cross-platform nature. -- I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving... At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder. ;) YMMV, but I always just change them to be on the safe side, but that's just how I roll... If you're worried about is use DIRECTORY_SEPARATOR rather than hard-coding it. Writing portable code is not difficult in PHP. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Here's the error I get: *Warning*: include(.\file.inc.php) [function.includehttp://www.emsplannertest.com/function.include]: failed to open stream: No such file or directory in * C:\Inetpub\httpdocs\test.php* on line *3* *Warning*: include() [function.includehttp://www.emsplannertest.com/function.include]: Failed opening '.\file.inc.php' for inclusion (include_path='.;.\includes;.\pear') in *C:\Inetpub\httpdocs\test.php* on line *3* This works fine on my old server which is running PHP 4.3.9. I honestly feel like I'm overlooking some stupid tiny thing. Are my permissions correct? Is it possible to debug this and look at the full path of file.inc.php that PHP is trying to load? Thanks! On Mon, Apr 7, 2008 at 7:36 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); That's pretty vague, Noah. Is it unable to locate the file? What's the error message you're receiving? Also, what happens if you create two simple files in the same directory like so: ?php // file1.php echo Okay.\n; ? ?php // file2.php include(dirname(__FILE__).'/file1.php'); ? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed!
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 11:52 AM, Wolf [EMAIL PROTECTED] wrote: Noah, Looks like you need to be deciding on whether or not you are on windoze or *Nix. If on Windoze, your include path is \ If on *Nix, your include path is / Notice the direction of the slashes and code appropriately in all locations. Actually, PHP is smart enough to allow both on Windows. Otherwise, everyone would need to update their code for each different system, which destroys PHP's cross-platform nature. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: Here's the error I get: Warning: include(.\file.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Inetpub\httpdocs\test.php on line 3 Warning: include() [function.include]: Failed opening '.\file.inc.php' for inclusion (include_path='.;.\includes;.\pear') in C:\Inetpub\httpdocs\test.php on line 3 If you're going to use Windows-style paths, try escaping your slashes and see what happens. ?php include(.\\file.inc.php); ? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Daniel Brown wrote: On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: Here's the error I get: Warning: include(.\file.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Inetpub\httpdocs\test.php on line 3 Warning: include() [function.include]: Failed opening '.\file.inc.php' for inclusion (include_path='.;.\includes;.\pear') in C:\Inetpub\httpdocs\test.php on line 3 If you're going to use Windows-style paths, try escaping your slashes and see what happens. ?php include(.\\file.inc.php); ? People seem to be missing the point here. These are PUBLIC applications that are failing to work for Noah. He should not need to re-write PHPMyAdmin in order to get it to work? Next people will be saying that we should re-write PHP if it does not work for us. Noah - I know that some 'security' has been added to the include function, but I'm not sure why you are having problems. I'm running applications on windows and Linux and the ./otherdir/ select is working fine. -- Lester Caine - G8HFL - Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://home.lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Mon, Apr 7, 2008 at 1:05 PM, Lester Caine [EMAIL PROTECTED] wrote: People seem to be missing the point here. These are PUBLIC applications that are failing to work for Noah. He should not need to re-write PHPMyAdmin in order to get it to work? Next people will be saying that we should re-write PHP if it does not work for us. Oh, did I say that? Must not have been paying attention as I typed in words to that effect. Sorry. I'm giving steps to debug and recreate the issue, not to rewrite anyone else's code. You may have noticed where I mentioned cross-platform portability. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Lester Caine [EMAIL PROTECTED] wrote: Daniel Brown wrote: On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: Here's the error I get: Warning: include(.\file.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Inetpub\httpdocs\test.php on line 3 Warning: include() [function.include]: Failed opening '.\file.inc.php' for inclusion (include_path='.;.\includes;.\pear') in C:\Inetpub\httpdocs\test.php on line 3 If you're going to use Windows-style paths, try escaping your slashes and see what happens. ?php include(.\\file.inc.php); ? People seem to be missing the point here. These are PUBLIC applications that are failing to work for Noah. He should not need to re-write PHPMyAdmin in order to get it to work? Next people will be saying that we should re-write PHP if it does not work for us. Noah - I know that some 'security' has been added to the include function, but I'm not sure why you are having problems. I'm running applications on windows and Linux and the ./otherdir/ select is working fine. -- Funny, none of the code *I* have seen posted to the list looks like it it phpMyAdmin or anything else public And since when did basic debugging mean you look past the basics? Noah- Change the includes to REQUIRE and see if the path that it outputs helps you out any with trying to figure out where things have gone wrong. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include fails when ./ is in front of file name
This works: include(file.inc.php); This doesn't: include(./file.inc.php); I can't figure it out! PHPMyAdmin uses ./ so it's obviously not working. Here's my environment: Win2003 Server w/ IIS 6 PHP 5.2.5 setup as ISAPI All PHP and httpdoc directories have read, write, and execute permissions given to IIS_WPG, IIS_USER, and NETWORK SERVICE PHP.ini's include path is: include_path = .;.\includes;.\pear (I've also tried include_path = .;./includes;./pear) phpinfo() works fine. Anyone have any ideas? Thanks! Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
On Sun, Apr 6, 2008 at 2:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); I can't figure it out! PHPMyAdmin uses ./ so it's obviously not working. Here's my environment: Win2003 Server w/ IIS 6 PHP 5.2.5 setup as ISAPI All PHP and httpdoc directories have read, write, and execute permissions given to IIS_WPG, IIS_USER, and NETWORK SERVICE PHP.ini's include path is: include_path = .;.\includes;.\pear (I've also tried include_path = .;./includes;./pear) phpinfo() works fine. Anyone have any ideas? Thanks! Noah Is that include() statement being issued within an included PHP page? a.php ?php include('directory/b.php'); ? directory/b.php ?php include('./c.php'); // Does this refer to c.php or directory/c.php ? -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include fails when ./ is in front of file name
Casey -- nope. the include statement is being issues from the parent page. both files are in the same directory. Nitsan -- the problem is apps like phpMyAdmin are littered with include(./file.inc.php); i'd have to replace all those to use full paths. it's not a good idea from a servicability statement anyways. thanks! On Sun, Apr 6, 2008 at 4:21 PM, Casey [EMAIL PROTECTED] wrote: On Sun, Apr 6, 2008 at 2:17 PM, Noah Spitzer-Williams [EMAIL PROTECTED] wrote: This works: include(file.inc.php); This doesn't: include(./file.inc.php); I can't figure it out! PHPMyAdmin uses ./ so it's obviously not working. Here's my environment: Win2003 Server w/ IIS 6 PHP 5.2.5 setup as ISAPI All PHP and httpdoc directories have read, write, and execute permissions given to IIS_WPG, IIS_USER, and NETWORK SERVICE PHP.ini's include path is: include_path = .;.\includes;.\pear (I've also tried include_path = .;./includes;./pear) phpinfo() works fine. Anyone have any ideas? Thanks! Noah Is that include() statement being issued within an included PHP page? a.php ?php include('directory/b.php'); ? directory/b.php ?php include('./c.php'); // Does this refer to c.php or directory/c.php ? -- -Casey