jack_wetson Posted April 28, 2010 Share Posted April 28, 2010 So... I have a file clients server that I wan't to use functions from a script on our work server, and I keep getting the error that the function im trying to use is un-defined, im probably doing it wrong so any help would be greatly appreciated. Client's Server include ($cms_Server."/functions/db.php"; dbconnect(); Work Server <?php function dbconnect() { mysql_connect("*snip*", "*snip*", "*snip*") or die(mysql_error()); } function dbselect($db) { mysql_select_db($db) or die(mysql_error()); } ?> Error: Fatal error: Call to undefined function dbconnect() in C:\xampp\htdocs\client\cms_index.php on line 20 Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/ Share on other sites More sharing options...
anups Posted April 28, 2010 Share Posted April 28, 2010 What is the value of $cms_Server ? Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049804 Share on other sites More sharing options...
ignace Posted April 28, 2010 Share Posted April 28, 2010 What is the value of $cms_Server ? I think this is quite obvious http://www.work-server.com And this indeed doesn't work because your .php is parsed on the client server and the result is returned as a response so you'll have to rename it to for example .inc However I do not recommend it as anyone will be able to look up your source code. Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049805 Share on other sites More sharing options...
jack_wetson Posted April 28, 2010 Author Share Posted April 28, 2010 I have re-named it to .inc but for some reason now it can't find the file, could this be an IIS problem? Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049810 Share on other sites More sharing options...
Mchl Posted April 28, 2010 Share Posted April 28, 2010 Is this function supposed to execute on remote server (from where you're trying to include it) or on a local machine? Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049818 Share on other sites More sharing options...
ignace Posted April 28, 2010 Share Posted April 28, 2010 Have you got this setup? Server: functions.inc Client: require('http://server.com/functions.inc'); Also allow_url_include should be set to On on your Client Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049819 Share on other sites More sharing options...
salathe Posted April 28, 2010 Share Posted April 28, 2010 Is there any particular technical reason why that file must be on the work server? Including remote files is terribly inefficient, not to mention the security implications of passing the database credentials over the wire (assuming SSL isn't used). Link to comment https://forums.phpfreaks.com/topic/200021-remote-functions-is-it-possible/#findComment-1049821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.