February 18th, 2010
In addition to having a great name, the PHP.ini configuration file can help you set a broad number of parameters on your server including paths for certain types of files, file extensions and parameters for databases. While the default php.ini file will work for most purposes, specific application development might require you to update paths, parameters or settings to get optimal performance out of your software design.
You can improve the security, speed and functionality of your code with a proper .ini file with can improve the long run performance of your application. Although you may not have come across many .ini files, the file is just a basic text file which is used to configure applications with just a few changes. The file has a basic structure according to sections, variables and values written as such:
[Example Section] Example_variable=”variable_value”
While / is used in most PHP statements to comment out lines, you’ll have to use ; within the .ini file and also cannot have any spaces within the variable or value names. Being able to comment out particular sections or variables is particularly useful in testing or implementing new features. There are a wide variety of options within the file, and you’ll need to restart Apache in order to test out the new options.
There are a number of settings in the file which related to how PHP is used by your server, which is important since it impacts your coding standards. While many coders are used to the “<?php” tag, setting short_open_tag = On can also allow you to write in PHP with a basic “<?” opening command, which can save time when coding large applications. Although it may seem trivial shortcuts can be quite useful when you get in the rhythm of programming.
Another important option in this section relates to optimizing your PHP code for speed and efficiency. In particular you can set output buffering which provides dedicated memory for your script to improve load times and steady page loading. You can set the size of the buffer, as well as the binary on/off setting for the variable.
As great as PHP can be, errors are inevitable in even the best written code. No matter how well you test your script, user actions can cause on site errors, even if they are harmless. Php.ini provides a variety of settings that allow you to determine how your server reports the errors and how they impact the overall script. By default, your server will stop processing a script when it encounters a fatal error, and you can ensure you receive notification of these errors by turning the log_errors variable on. This is important since you don’t want potential hackers to see your underlying script that can help them identify errors, as well as avoiding confusion of users when they encounter code. You can accomplish this with three primary settings, turning display_errors to off, turning log_errors to on and writing an error_log which can store the resulting data.
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment