Auto Append Prepend file in all files

IF we want to include header, footer or any boot file in all files inside our project. We can achieve this using PHP files, .htaccess or php.ini file

1. We need to write in each file of with PHP extension
2. In .htaccess or php.ini file we need to write only once and it will appears in all files automatic.

In PHP file

In php.ini file
# Prepend the file need to specify a relative path
auto_prepend_file = “/public_html/talkforweb/boot.php”

# Append file to bottom of page
auto_append_file = “/public_html/talkforweb/boot.php”

In .htaccess file
# Prepend the file need to specify a relative path
php_value auto_prepend_file “/public_html/talkforweb/boot.php”

# Append file to bottom of page
php_value auto_append_file “/public_html/talkforweb/boot.php”

By searching in detail list we can find php.ini file path but
Some hosting provide not provide access to edit php.ini file in this case we can create new file inside your root folder with name ‘php.ini’ and add above code.

Leave a Reply

Your email address will not be published. Required fields are marked *