One more thing. require() produces a fatal error, if an error occurs. include() just produces an error message.
Ideally, you don’t want either one shown to your readers, as it will reveal your filesystem paths. Using an “@” before most functions will supress any error output if they fail:
It’s generally a good practice to disable error output globally. In .htaccess:
php_flag display_errors off
php_flag log_errors on
This will cause your errors to be sent to your error log, not to the client.
Now the cool bit. If you move servers, you’ll be forced to edit the path of your require function on every page, because you are currently using a relative-from-root path. Instead, put this code at the beginning of all your pages, which makes use of a special environment variable:
Even simpler is to simply not use a path in your include() or require() statements at all, and just set your PHP include path in .htaccess with the directory you keep that stuff in:
php_value include_path ".:/path/to/your/include/directory:/path/to/secondary/directory"
This way you can include files in multiple directories without having to type out full paths for any of them.
If you want useful replies, ask smart questions.