Why does the require_once function work on localhost but does not work on the server?

0

Dear, I have a framework that accesses data from other servers, I programmed every system in localhost, on my machine. However, when playing to the server, the external call of pages does not work, for example:

require_once("http://meusite.com.br/pagina.php");   

Already set allow_url_include = On and allow_url_fopen = On, but does not work.

Errors appear: Warning: require_once (' link '): failed to open stream: Connection timed out in /var/www/page.php on line 231 Fatal error: require_once (): Failed opening required ' link ' (include_path = '.: / usr / share / php: / usr / share / pear ') in / var / www / i9 / page online 231

Detail: Although I wanted to include pages from other servers, the server that I refer to as "myite.com" is the server itself where "page.php" is. Could that be the problem? That instead of using the require_once via url, am I forced to use the DIR path?

Will I need to use file_gets_content ()?

    
asked by anonymous 12.04.2016 / 15:00

1 answer

2

In fact, most problems with time_out if it is not due to your apache server's settings, may be as in my case.

I was able to solve the problem, the point is that I was pointing the function file_gets_content () to the server itself which spliced the application I want. That is, instead of using "localhost" I used " link " generating a certain type of looping on the server.

Problem solved!

    
21.06.2016 / 22:15