...

View Full Version : how to include php file from another server without bugs ??



crazy.works
03-25-2010, 03:29 AM
hello, i wanna include php file in one script of mine from another server without getting bugs in my script.

inside that php file some important functions that i can't put in the same place with the script in the same server, and that is why i upload the file in other server and i include it inside the script...

i did some more work on this thing in the last few days and here is what i ended with:-
1. i can include the php file from the server "A" into my script in server "B", by using include("http://site.com/path/file.php"); and editing php.ini with setting allow_url_include = On
2. when i include the php file from another server, it works find but the functions and the classes doesn't work.
3. to get the access to the functions and the classes, i have to include the file with a different extension - such as '.inc' This way the php interpreter will not 'get in the way' and the text will be included normally.... so i have to include the file like this include("http://site.com/path/file.inc");
4. i get huge problem by renaming the file in server "A" from 'file.php' to 'file.inc', because the server will consider it as a text and it will be viewable as a text in any browser !!

so please anybody got any idea about how to get access to the functions and the classes without renaming the file extension ??? or anybody know good idea to make the file non-viewable in the browsers after renaming it to file.inc ???

DJCMBear
03-25-2010, 03:36 AM
you can only include/require a file from a different server if you current server has outside access otherwise you cant do this. And to stop files being viewable use a .htacces deny all code

crazy.works
03-25-2010, 03:54 AM
you can only include/require a file from a different server if you current server has outside access otherwise you cant do this. And to stop files being viewable use a .htacces deny all code


i know that my current server have to has outside access to include file from a different server...i mentioned previously about i edited php.ini for that...but the problem is i don't get access to the function and the classes inside the file with the '.php' extension as i explained...

and about ur .htacces deny all code solution, i tried it but it deny the access for the browsers and the include too, so it makes me unable to access it by the including :confused:

DJCMBear
03-25-2010, 03:59 AM
and about ur .htacces deny all code solution, i tried it but it deny the access for the browsers and the include too, so it makes me unable to access it by the including :confused:


Your server has to be set up wrong then because I have done this to secure files and I could still access them through include/require.



i know that my current server have to has outside access to include file from a different server...i mentioned previously about i edited php.ini for that...but the problem is i don't get access to the function and the classes inside the file with the '.php' extension as i explained...


including a file on the same server or a different server its still calling the file and its contents so like i said before your set up must be wrong seeing as its not allowing you to use codes that are there.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum