CityHost.UA
Help and support

auto_prepend_file — include a file

The auto_prepend_file parameter allows you to specify a file that is automatically executed before any PHP script is launched. That is, before any code on your site is launched, this file is automatically included first.

 

Most often, this mechanism is used to integrate security systems (for example, Web Application Firewall), as well as to implement global rules or libraries that should work on sites. Thus, auto_prepend_file allows you to manage the environment even before the main site code is launched, providing unified control and increased security.

 

How to configure?

 

Log in to Control Panel - select the section Hosting 2.0 - Management

Go to the SITES tab, and opposite the PHP Settings item, click on the EDIT button:

 

In the settings that open, find the auto_prepend_file field and specify the path to the file.

 

Please note! The path is specified from the root of your account. The file must be within the access limits specified by the open_basedir parameter.

 

Then click Save.

 

 

Changes take effect immediately.

 

Attention: Using the die or exit commands in files connected via auto_prepend_file stops the execution of the entire script, regardless of subsequent code. This can lead to a complete shutdown of the sites on the account, so only code that executes without interruption should be placed in such files.