Why is "require" in PHP not working?

I have tried this before so I don’t have any hosted example as of right now but I gotta ask…

When require in php is used, nothing will load until the element specified is loaded too,
In my example it’s a navbar.

When I want to use a navbar (which is hosted on infinity free) and use a require, navbar doesn’t load resulting to other elements to not load either.

Is that another one of InfinityFree’s weird policies so I have to manually update every navbar on every pages or am I doing something wrong?

Worth to mention

Also, when Include is used it doesn’t load navbar either.

If this can help you


Just to let you know, seeing how you mentioned where this navbar was hosted: we only allow using requires and includes with local files (using local paths), not with website URLs. So you can’t require in a navbar from any HTTP(S) address anywhere, no matter where it’s hosted.

So, for example, if you page a page at http://example.com/about.php and a shared header in the same folder, you will need to do require 'header.php';, not require 'http://example.com/header.php';. The latter will not work.

Besides that, if you provide a generalized description, we can only give you a generalized answer. Please provide example code or an example URL where we can see this for ourselves if you want more specifc answers.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.