Re: Using remote include config file and class in a local file

From: Date: Wed, 04 Nov 2009 15:37:02 +0000
Subject: Re: Using remote include config file and class in a local file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-299617@lists.php.net to get a copy of this message
Shawn McKenzie wrote:
Anton Heuschen wrote:
Question is wrt to including a config file on an external server in a local include Lets say that on 127.0.0.1 I have test.php with include http://200.200.1.1/Folder/Config.php $obj = new RemoteClass() do stuff and on server 200.200.1.1 I have my Config.php file which is contains the class RemoteClass() { echo "test" } If I try to test it locally it says it cannot find RemoteClass ... How can I include/require a config (or any other php classes file) on my local running php script ?
As others have said, you are receiving the output of the config.php after it has been parsed by PHP on the remote server. You could try naming it config.cfg, config.conf, config.ini, config.inc, etc...
multiple choice - why not use PHAR - on remote server enable .phps (php source) - remove "SetHandler application/x-httpd-php" in you apache conf (if on apache, and obviously realise this won't let any php scripts run through http) - mount the remote file system locally and.. why? normal approach would be to expose the remote functionality needed as a web service and call it via SOAP/RPC/REST etc however.. always fancied the idea of a central server for php libs that can be included at runtime (with some local cache'ing and version checking) - would make most sense if we all used a single version of the same libs & only one copy etc etc regards

« previous php.general (#299617) next »