Appendix B. Configuring PHP
This appendix assumes that you have the Web software installed.
PHP has many configuration settings that determine how it behaves. I talk about PHP settings at various places throughout the book. For instance, I talk about the PHP error settings when I explain how PHP errors work in Chapter 6. I explain the settings and when they need to be changed in context in the book.
The configuration settings are stored in a text file named php.ini. PHP looks for the file php.ini when it begins and uses the settings it finds. If PHP can't find the file, it uses a set of default settings.
All PHP settings can be changed in the php.ini file. Some settings should always be changed, and some should be changed only in specific circumstances. For example, magic quotes should always be turned off. I explain magic quotes in Chapter 6.
On your own computer, you always have access to the php.ini file and can change the settings yourself. However, a Web host isn't going to allow you access to the general php.ini file, because it controls the settings for all the users on the computer, not just for your site. So, you change any PHP settings on your Web hosting account with a different procedure:
A local
php.inifile: Some Web hosts allow you to have a localphp.inifile that controls: PHP's behavior for your Web site only. If so, you can make any needed changes in this localphp.inifile.An
.htaccessfile You can add directives to your.htaccessfile that change PHP settings. Only ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access