Chen
Chen

Reputation: 11

change path for include/require only once

I have a lot of sites - all hosted on my server. I want one of them to access file from /vhost which is a directory above httpdocs where the domain is linked.

I know that there is an option to change the path in httpd.conf but that is a lot of work to change all the includes in my sites.

Upvotes: 1

Views: 415

Answers (1)

Pentium10
Pentium10

Reputation: 207838

Use the function ini_set(). For example if you wanted to set your PHP include_path to ".:../:./include:../include" then you would do this in your PHP code:

ini_set("include_path", ".:../:./include:../include");

You can also use ini_set() to affect other PHP settings like auto_prepend_file, auto_append_file, error_reporting, etc.

Upvotes: 1

Related Questions