Miscellaneous

  Home arrow Miscellaneous arrow Page 2 - Controlling PHP
MISCELLANEOUS

Controlling PHP
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-06-15

    Table of Contents:
  • Controlling PHP
  • php.ini
  • httpd.conf
  • Window's Registry
  • PHP Scripts
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Controlling PHP - php.ini


    (Page 2 of 6 )

    One way in which the behavior of PHP can be modified is through it's main configuration file, php.ini. While PHP will happily run without it, it's a good to be use this file to fine tune your PHP installation.

    PHP first looks in the current working directory for php.ini. If it's not found in the current directory, PHP then looks to the default path for the configuration file. The default path is /usr/local/lib but can be changed at compile time using the --with-config-file-path option.

    If PHP runs as an Apache module, because it's loaded when Apache starts and remains in memory then php.ini will only be parsed once. Configuration changes require Apache to be restarted.

    In contrast, if PHP runs as a standalone interpreter for CGI scripts then php.ini is parsed each time the PHP processor is loaded (each time a script is called). No other services need to be reloaded for the changes to take effect.

    The php.ini file is not installed by default. Instead, there are two copies in the source directory that may be copied and renamed: php.ini-recommended and php.ini-dist. The first one is geared more towards controlling PHP's behavior to provide a development environment while the later is sets options suitable for a production environment.

    php.ini uses the semicolon to denote comments. Any line beginning with a semicolon, or any text following a semicolon up until the end of the line will be ignored when the file is parsed.

    Various configuration options that are related to one another are grouped and labeled with section markers. These section markers appear in square braces and are also ignored.

    Here is a simplified excerpt from the php.ini-recommended file:

    [PHP]
    ; Enable the PHP scripting language engine under Apache
    engine = On

    ; Allow ASP-style <% %> tags
    asp_tags = Off

    ; The number of significant digits displayed in floating
    ; point numbers
    precision = 14

    The PHP section marker shows that the following directives are global options that affect the overall operation of PHP (as opposed to more specialized options which affect specific modules and extensions).

    Informational comments explain the various options. They're there just for the sake of convenience and are ignored by PHP when it parses the configuration file.

    The actual configuration option consists of two parts: the directive and it's value. Some directives are boolean in nature and can either be set to on or off. Others can be set to string or integer values.

    More Miscellaneous Articles
    More By bluephoenix

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap