How to include URL or file in PHP codes
Posted by on 09 May 2013 10:40 PM
There are 2 scenarios here:
1. To include a PHP file inside hosting space:
Document root: /home/user/public_html/
Index page: /home/user/public_html/index.php
header to be included: /home/user/public_html/include/header.php
Here you can use relative path in index.php:
2. To include a URL in PHP codes:
If the PHP page to be included is an external URL, you would need to enable allow_url_include in PHP.INI. Do note that allowing allow_url_include is a security risk and this is not enabled by default on our shared servers. See http://blog.arvixe.com/setting-custom-php-ini-files-for-your-website/ to see the steps to enable custom php.ini (set allow_url_include to "On" there).
allow_url_include only needs to be enabled if it is an external URL and you need to include that in your codes.