1. php.ini locations

    May 30, 2008 by pierre

    Once it is compiled, PHP can be configured using a file called “php.ini”.

    If you are using PHP as a server module (mod_php in Apache) this file is read when the server is started, this implies that you need to restart the server to update the configuration. But using php via CGI or command line interface, it is read each time a script is executed.

    You can have several php.ini files and it is searched in an ordered orthodox serie of locations. Thanks to this feature you can have specific configurations of PHP per level of directory trees on your server. In some systems though (we just experienced this on a Site5 shared hosting account) you can somehow bypass this list (I don’t know exaclty how you do this) and have php.ini files setting the defaults for only the folder that contains it. In other words each php.ini files can then only affect scripts that are in the same folder.

    For example if you are using a script to upload files bigger than than upload_max_filesize you can reset this limit in a php.ini file but it then has to be in the same folder as your uploading script. In this situation if you are using a framework like Code Igniter or CakePHP the code that is executed when you upload a file will be scattered in many files and directories. We thought and googled hard for a cleaner solution (please comment if you know a better way!), but we ended up duplicating the php.ini file in all the application and framework core dirs so that our settings are applied correctly.

    To do this from the command line, cd to the top dir containing the php.ini file and do something like:

    for i in `ls -aR | grep \: | cut -f 1 -d :`; do if [ -d $i ]; then cp php.ini $i; fi; done

  2. site down check-list

    March 23, 2008 by pierre

    Some parts are dreamhost centric.

    Is it down just for me:

    1/ ssh to another machine and: $ ping thedomain.com
    2/ http://downforeveryoneorjustme.com/

    Dreamhost status:

    1/ http://www.dreamhoststatus.com/
    2/ schedule tests

    DNS status:

    $ whois thedomain.com (check that the name servers are ns1.dreahmost.com, ns2.dreahmost.com, ns3.dreahmost.com)
    $ host thedomain.com
    $ dig thedomain.com

    $ traceroute thedomain.com