Hi. I'm new to PHP and writing a script for myself. I have a settings.php which contains the informations of my site. (included all pages) <?php $siteurl = "www.sitename.com"; etc.etc. ?> I've put my site's link into it. It works on localhost but doesn't work on the server. The firm said they blocked php_network_getaddresses function in order to protect hostings from hacking attacks, is that right? If so, what can I do else? I have main php files, I call 4 included pages (like header, footer etc) This is how I use the code, <?php include("$siteurl./include/header.php"); ?> and This is the warning I get Warning: main() [function.main]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/dipoer/public_html/script/demo/index.php Code (markup):
Don't use URLs in your includes(), use system file path instead eg. include('/home/myaccount/includes/whatever.php');
Don't use them anyways, even if they are allowed by your host, as they add to processing load, as PHP wastes time only to figure out the file is on the same server as the script. If you must use absolute paths, use something like $siteroot instead of $siteurl with $siteroot being the document root, which is available in the PHP $_SERVER array: $_SERVER['DOCUMENT_ROOT'] <?php $siteroot = $_SERVER['DOCUMENT_ROOT']; ?> // ... <?php include("$siteroot/include/header.php"); ?> PHP: