|
Posted by Rik on 08/13/07 19:52
On Mon, 13 Aug 2007 21:38:39 +0200, Jerim79 <mylek@hotmail.com> wrote:
> Probably an incredibly simple answer, but I can't seem to phrase it so
> a search engine can understand it.
>
> I have a php script with a simple include:
> include("/include_this.php")
>
> I need to edit this so it accesses the file from another server. I
> have tried:
> include("http://192.168.1.1/include_this.php:)
>
> But the file isn't in the web directory, which in this case is /usr/
> local/apache/htdocs. It is one level above the web directory. I don't
> know how to reference /usr/local/apache/include_this.php on another
> linux server. I don't even know what the correct term or phrase would
> be for this. Any help will be greatly appreciated.
>
(some of the) possibilities:
1. Put in in a direcory that _is_ accessable through the webserver, and
turn of PHP parsing for that directory, or give at an extention not
recognized as php (as you have to include the code, not the output) (Not
recommended: unnecessary overhead & possible security risk, as your code
is exposed).
2. Create a script on the server in an accessable directory that fetches
the source of the script and passes it on (using file_get_contents). (Same
security & overhead drawback as (1)).
3. Create an SMB share, mount it & link to it in the script.(cumbersome,
but could work)
4. Create a copy on the other server, and keep them in sync using stuff
like CVS/SVN, possibly even rsync, maybe schedule syncing). (preferred,
would be the fastest & safest with less overhead)
5. Put an FTP server up, fetch the file & parse it (again, unneccesary
overhead).
6. I'm sure there are lots of other ways....
I'd go for (4) anytime.
--
Rik Wasmus
Navigation:
[Reply to this message]
|