tried it mate and still same error ...im sure its the php.ini file but im just getting back into php and bit rusty

    tried it mate and still same error ...im sure its the php.ini file but im just getting back into php and bit rusty

    I think the php.ini setting is fine since it includes ".", i.e., the current directory.

    What is the location of this test script, and the location of test3.htm? Give the absolute paths, please.

      test script is here on the IIS6 test server

      include 'test2.php'; lives here which is where the index5.php file lives
      C:\Inetpub\wwwroot\home_page\

      File2
      test3.htm
      this lives on a totally different server
      \server1\tmp\test3.htm

      Now this opens on a server I have no access to but all the permissions are open and you can view it in a browser so im a lil confused thanks for your hhelp

        why do I have in my head you need to add another directory to the include_path to jump from its own server to another ?

        ".c:\php\includes:\server1\tmp" I dont know if the syntax is correct for this though

          Oh... no wonder. You're accessing test3.htm over a network drive, right? I am afraid I have no experience in that (or in network drives, for that matter).

          An alternative if to access test3.htm over say, HTTP, but then if it were a PHP script instead, you would only get the clientside output. In this case it does not matter either way, though I would more typically use [man]file_get_contents/man if I have to access over a network protocol.

            the file im trying to access is a simple test file it just produces a table thats all for testing purposes...

            it doesnt have to be a .php file it could be a .htm but its a unix box so would file_get_contents() work for this? I have never used it always used includes but saying that never had to access over a network drive its always been local so includes always work
            Thanks

              include_path=".;c:\php\includes;server1\tmp\;server2\tmp"

              surely this would work does anyone know ?

                No, it won't. UNC paths start with two backslashes.

                Besides, if something won't work in an include() statement, why would adding the directory to the include_path directive change anything? If that indeed solved anything, then that would surely be a bug in PHP.

                Your problem is that backslashes are escape characters, so you have to escape each backslash so that PHP knows you mean a literal backslash, i.e.

                \\\\server\\dir1\\file.htm

                EDIT: Also note that the IIS worker process has to have credentials to logon to the folder on the remote machine or else you have to add the local system account to the remote ACL!

                  Hi

                  The folder is total open access you can browse to the file in IE or Explorer or whatever and the file displays as it should so I guess the \\ code should then work if the Remote server and file location is complete open access ?

                    ur on a network yea and wanting to access a file in that server through LAN and so i think

                    include 'file:\\SERVER1\tmp\test3.htm';
                    

                      so you have to use file: then use the location to declare it !!!

                      il try the above code tomorrow when im back inw ork and let you know thanks for the help

                        If you use the file: protocol, I believe it should be file:///servername/dir/file as noted on the manual page for [man]wrappers[/man].

                        Either way, though, should work.

                        crashpolo wrote:

                        you can browse to the file in IE or Explorer or whatever and the file displays as it should

                        None of that tells you much about the security ACL on the remote share - only that you can access it using the credentials you logged onto the computer with.

                        Most likely you used a domain account which of course has credentials for that folder. By default (I think), however, IIS doesn't run under a domain account - it runs using the Local Service or maybe even Network Service account which may or may not have permissions on the remote share.

                        If this is the case, though, you should get an error message about a permissions issue, though.

                          Hi

                          Im pretty sure IIS 6 is based on the domain admin account which pretty much accessing everything so Ill let you know how I get on .... thanks once again for the pointer dont think permissions will be an issue but will soon see cheers...

                            Alright. Sorry if I'm too paranoid/persistent on the whole permissions issue... I've run into problems in the past in a domain setting and just wanted to make sure you don't have to repeat my experience with it! :p

                              its ok mate got it working thanks for the help ....forgot to restart the services oops 🙂 \\ works nicely but also realise that this include is a bad idea due to code injection in remote files...so may use a the copy function instead ...

                              How would i check a file to strip out the !php tag before displaying ?

                                In that case, do not use include. Use something like file_get_contents() or readfile() instead.

                                  could do yeah ! but would file_get_contents be able to display all the content as like the include does ?

                                  Or I could strip out !php tag in the remote file before the include displays the file

                                    could do yeah ! but would file_get_contents be able to display all the content as like the include does ?

                                    Of course, since your intention is to stop any possibility of parsing as PHP.

                                      Write a Reply...