![]() |
Include code from other server ?
I am running 2 servers, one in the USA and one in the UK.
To make updates easier I want to ınclude php files from the USA server in the php scripts of the UK server. So I will have : PHP Code:
physical server by using a directory outside the local html directory. EG using : PHP Code:
Javascript can pull code off any website and use it, can php do a similar thing by using the url to get the php file and then include it ? Thanks. . |
Don't try it. Too big of a security risk.
But if you still want to push it on, take a look at: http://httpd.apache.org/docs/2.0/mod/mod_access.html Basically, you allow access using .htacess to a particular IP. (Never done it though) Like: Code:
<Directory *> |
this can't be done, PHP is a server side language. have a look at PHP SOAP web services.
|
Of course it can be done - if he sets the proper permissions and has the proper login and acess credentials for servers and script at each end.
Hell, he can even use FTP to get the local file and save it to a local folder. Using PHP and FTP with ftp_get(). Actually, it's easier to use ftp_get() then just call the newly saved file instead of sever configurations that will leave a huge gaping security hole. |
thats a terrible solution. SOAP is the proper way to share remote functionality.
|
sure, lots of things are possible, he could even use Samba and create a long range share and mapping of the remote device, but again bad security, not the proper way to accomplish this and not what any experienced developer would call any elegant solution.
|
True, but the man doesn't want to interchange info, he wants to be able to include PHP code not available locally. SOAP won't do that for you mate. Elegant yes, but not the solution.
He wants a simple include('file_to_be_included.php'). And how is using PHP's FTP usage hacky and dirty? Its in the core of the PHP language and only needs 3 lines of code to implement such functionality. |
what makes you think that SOAP can't be used to simply include content?
|
Hmm...it actually can. Call another page that will read the.php files contents and then send it to the calling php file. Yeah. I must have just zoned out when you said:
Code:
"this can't be done, PHP is a server side language. have a look at PHP SOAP web services. "Hmpff. Haha. :) |
Is accessing a database on a different
physical server less of a problem ? I usually just have something like: PHP Code:
I guess I need something other than "localhost". What should I put in there in order to ensure access ? Thanks . |
Yes, Remote MySQL is just like normal except no localhost for hostname. You use something like...
PHP Code:
You ussually have a hostname where you login fo phpmyadmin and such. Most hosts give this for use in scripts. e.g mysql.yourdomain.com . Just check with your host the subdomain or path for MySQL access. |
yes, if the ports are open on your firewall/router and your MySQL server is configured correctly to bind to any local address then yes, you can connect to the MySQL server from anywhere.
|
Quote:
Since when was http used for all TCP based connections? :confused: I've never known http be used for anything but webservers. @Jeddi: What redcoder is saying is almost correct except that you don't use http:// on the address. You only use the actual hostname. |
or IP address.
|
:eek: Hahaha. Tangoforce. My bad. Must be the lack of sleep...no, not me. Haha :thumbsup:
|
| All times are GMT +1. The time now is 04:40 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.