Loading...

Knowledge Base

How to include URL or file in PHP codes

Did you find this article helpful?
Copy Link

 
* Your feedback is too short
Share this article

There are 2 scenarios here:

1. To include a PHP file inside hosting space:

eg:

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:

<?

include "./include/header.php";

?>

2. To include a URL in PHP codes:

eg:

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.

allow_url_include only needs to be enabled if it is an external URL and you need to include that in your codes.

Did you find this article helpful?
Copy Link

 
* Your feedback is too short

Loading...