Archive for the ‘Linux’ Category.

Best Fortune Quote Ever

For those of you who aren’t familiar with Fortune it is a command line program for Linux that has a large database of selected quotes. Whenever you run the program from the command line it gives you one of the quotes from its database. Here is a picture of the one I got today, the best quote I think I have ever received.

Fortune quote

It’s the first, longer quote. Not sure why my theme didn’t get captured like the window did either.

Git Rebase on Cloned Repositories

So here I am for days trying to figure out why I cannot rebase a cloned git repository with the following command:

$  git rebase origin master

I suppose this would have worked had my branch repository actually been inside the main repository, instead of a clone that was out-of-tree. Well, the answer is simple enough:

$ git pull --rebase

This has the intended behavior of undoing any local commits, applying the commits from upstream, and then re-applying the local commits. This is an awesome feature of GIT and I use it all the time.

Safe CFlags for GCC

I just found this very handy page over on the gentoo wiki about safe cflags to use with different processors. I came across this when searching for cflags to use on a new Intel Atom machine that I just bought for my grandpa.

Here are the flags I used to make this relatively underpowered Atom machine seem quite usable and fast:

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"

Making a (Covert) BitTorrent Seed Box

Making a Linux bit torrent seed box is easy easy easy. There’s two main steps involved in this:

  1. Get a computer, put some Linux on it.
  2. Sneak said computer onto campus and hide it somewhere that is inconspicuous and close to both power and LAN.

Getting computer and putting Linux on it

This is pretty straightforward. You need a PC of some kind. Any kind will do really, I used an old roomates PC that did not have a side door on it. I installed Arch Linux (note: you can use any Linux, or BSD for that matter) onto it and configured it to my liking. You will also need some sort of bit torrent daemon. I suggest either rtorrent (That’s what I used) or transmission-daemon. There are others out there but these are the ones I have experience with and they work well. If you want to use something different then go ahead but you may need to consult additional resources. You probably want this computer to be headless so you can hide it somewhere good. Make sure you have configured it in a way that you can control the box remotely. I highly suggest SSH.

Sneaking computer into strategic location

Now this is the part that requires some nerve. You need to find a spot on campus (or at some other publically available high bandwidth sight. In Canada we don’t have too many of these besides Universities) that you can hide this computer for a few months without anyone screwing with it and IT not finding it. I hid mine in a graduate offices common area under a carousel that was close to both LAN and power. This spot proved to be awesome as I had quite a lot of bandwidth (10MBits up/down) over which I transferred nearly 7TB of data (Thanks U of C — I will never complain about tuition prices again I promise).

So think of somewhere that is similar to this and plant your box. Power it up and make sure you can connect to it remotely. Start downloading torrents and seeding them like mad. You will wan’t to have the largest hard drive you have available in this computer as you want lots of content for potential peers to download.

Just chill, download everything you can get your hands on. Every couple of months rotate the data off the seed box onto more permanent media. This will also allow you to download fresh new content and maintain high upload rates. Doing this is mostly a waiting game so just sit back. The longest uptime I ever had on my machine was like 80 or 90 days.

I hope this article was enlightening but I must have a small disclaimer that downloading copyright materials may be illegal and you may want to check your nations laws before proceeding with this.

Upgrades

This is just a list of parts that I bought to go into this machine. I just use this so I can keep track of costs and dates of hardware.

  • Western Digital 500GB 7200 RPM 16MB IDE 99.99 December 16, 2008

Wordpress Install Overview

Installing Wordpress under and Unix or Unix-like operating system is not the most difficult thing I have ever tried to do. In this tutorial I will show you how to use the *AMP stack (Unix/Linux Apache Mysql and PHP) to serve Wordpress content.

Web Server

The first thing you need to do is install a web server of some kind. There are only 2 real alternatives for this, apache and lighttpd.

Apache is an industrial grade, professional web server that most of the internet uses. Plugins and extensive configuration are available to customize apache in almost any way you can imagine.

Lighttpd is a fast, light weight web server more aimed for ease of configuration at the expense of scalability. It comes with quite a few plugins and I have been using it for development work recently. Any professionally deployed website should use apache though.

Choose one of these and install it. If you choose to use lighttpd then you may need to consult some other resources on the internet to guide you from here. I always have used Wordpress with apache and so it is the only option that I am familiar enough with to write a tutorial about. Good Luck!

Installing either of these on a Unix-like operating system should be trivial. Fire up your package manager and install either of them by name. Make sure you configure the web server properly (Run at boot time, proper directories, edit any files that are put into the /etc/ directory) which may require some inspection of the documentation.

MySQL

MySQL is a very popular free and open source SQL database server. Lots of web applications require a database back end and most of the time this will include MySQL support. The MySQL server runs as a seperate process than apache and allows web applications served with apache to connect to it.

Fire up your package manager and install mysql by name. You will have to configure the mysql server properly which may include starting it at boot time. Consult any files mysql puts into the /etc/ directory and maybe inspect the documentation if you have any firther questions.

PHP

This step is mandatory if you are using Wordpress because Wordpress is writen in php. If you have a different blog software that does not require PHP then you would replace this step with installing the framework for the alternative blog software. Php can be found in every package management system I know of, and so you should install it by name.

Some package management systems break up the php install into different modules. If this is the case then you may wan’t to install the mysql php plugin at this time. Another plugin that Wordpress uses is gd.

Below is my php.ini file that I use to serve this blog with. Please use it for reference.

<br />
[PHP]</p>
<p>;;;;;;;;;;;;;;;;;;;<br />
; About php.ini?? ;<br />
;;;;;;;;;;;;;;;;;;;<br />
; This file controls many aspects of PHP's behavior.? In order for PHP to<br />
; read it, it must be named 'php.ini'.? PHP looks for it in the current<br />
; working directory, in the path designated by the environment variable<br />
; PHPRC, and in the path that was defined in compile time (in that order).<br />
; Under Windows, the compile-time path is the Windows directory.? The<br />
; path in which the php.ini file is looked for can be overridden using<br />
; the -c argument in command line mode.<br />
;<br />
; The syntax of the file is extremely simple.? Whitespace and Lines<br />
; beginning with a semicolon are silently ignored (as you probably guessed).<br />
; Section headers (e.g. [Foo]) are also silently ignored, even though<br />
; they might mean something in the future.<br />
;<br />
; Directives are specified using the following syntax:<br />
; directive = value<br />
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.<br />
;<br />
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one<br />
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression<br />
; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").<br />
;<br />
; Expressions in the INI file are limited to bitwise operators and parentheses:<br />
; |??????? bitwise OR<br />
; &??????? bitwise AND<br />
; ~??????? bitwise NOT<br />
; !??????? boolean NOT<br />
;<br />
; Boolean flags can be turned on using the values 1, On, True or Yes.<br />
; They can be turned off using the values 0, Off, False or No.<br />
;<br />
; An empty string can be denoted by simply not writing anything after the equal<br />
; sign, or by using the None keyword:<br />
;<br />
;? foo =???????? ; sets foo to an empty string<br />
;? foo = none??? ; sets foo to an empty string<br />
;? foo = "none"? ; sets foo to the string 'none'<br />
;<br />
; If you use constants in your value, and these constants belong to a<br />
; dynamically loaded extension (either a PHP extension or a Zend extension),<br />
; you may only use these constants *after* the line that loads the extension.<br />
;<br />
;<br />
;;;;;;;;;;;;;;;;;;;<br />
; About this file ;<br />
;;;;;;;;;;;;;;;;;;;<br />
; This is the recommended, PHP 5-style version of the php.ini-dist file.? It<br />
; sets some non standard settings, that make PHP more efficient, more secure,<br />
; and encourage cleaner coding.<br />
;<br />
; The price is that with these settings, PHP may be incompatible with some<br />
; applications, and sometimes, more difficult to develop with.? Using this<br />
; file is warmly recommended for production sites.? As all of the changes from<br />
; the standard settings are thoroughly documented, you can go over each one,<br />
; and decide whether you want to use it or not.<br />
;<br />
; For general information about the php.ini file, please consult the php.ini-dist<br />
; file, included in your PHP distribution.<br />
;<br />
; This file is different from the php.ini-dist file in the fact that it features<br />
; different values for several directives, in order to improve performance, while<br />
; possibly breaking compatibility with the standard out-of-the-box behavior of<br />
; PHP.? Please make sure you read what's different, and modify your scripts<br />
; accordingly, if you decide to use this file instead.<br />
;<br />
; - register_long_arrays = Off???? [Performance]<br />
;???? Disables registration of the older (and deprecated) long predefined array<br />
;???? variables ($HTTP_*_VARS).? Instead, use the superglobals that were<br />
;???? introduced in PHP 4.1.0<br />
; - display_errors = Off?????????? [Security]<br />
;???? With this directive set to off, errors that occur during the execution of<br />
;???? scripts will no longer be displayed as a part of the script output, and thus,<br />
;???? will no longer be exposed to remote users.? With some errors, the error message<br />
;???? content may expose information about your script, web server, or database<br />
;???? server that may be exploitable for hacking.? Production sites should have this<br />
;???? directive set to off.<br />
; - log_errors = On??????????????? [Security]<br />
;???? This directive complements the above one.? Any errors that occur during the<br />
;???? execution of your script will be logged (typically, to your server's error log,<br />
;???? but can be configured in several ways).? Along with setting display_errors to off,<br />
;???? this setup gives you the ability to fully understand what may have gone wrong,<br />
;???? without exposing any sensitive information to remote users.<br />
; - output_buffering = 4096??????? [Performance]<br />
;???? Set a 4KB output buffer.? Enabling output buffering typically results in less<br />
;???? writes, and sometimes less packets sent on the wire, which can often lead to<br />
;???? better performance.? The gain this directive actually yields greatly depends<br />
;???? on which Web server you're working with, and what kind of scripts you're using.<br />
; - register_argc_argv = Off?????? [Performance]<br />
;???? Disables registration of the somewhat redundant $argv and $argc global<br />
;???? variables.<br />
; - magic_quotes_gpc = Off???????? [Performance]<br />
;???? Input data is no longer escaped with slashes so that it can be sent into<br />
;???? SQL databases without further manipulation.? Instead, you should use the<br />
;???? database vendor specific escape string function on each input element you<br />
;???? wish to send to a database.<br />
; - variables_order = "GPCS"?????? [Performance]<br />
;???? The environment variables are not hashed into the $_ENV.? To access<br />
;???? environment variables, you can use getenv() instead.<br />
; - error_reporting = E_ALL??????? [Code Cleanliness, Security(?)]<br />
;???? By default, PHP suppresses errors of type E_NOTICE.? These error messages<br />
;???? are emitted for non-critical errors, but that could be a symptom of a bigger<br />
;???? problem.? Most notably, this will cause error messages about the use<br />
;???? of uninitialized variables to be displayed.<br />
; - allow_call_time_pass_reference = Off???? [Code cleanliness]<br />
;???? It's not possible to decide to force a variable to be passed by reference<br />
;???? when calling a function.? The PHP 4 style to do this is by making the<br />
;???? function require the relevant argument by reference.<br />
; - short_open_tag = Off?????????? [Portability]<br />
;???? Using short tags is discouraged when developing code meant for redistribution<br />
;???? since short tags may not be supported on the target server.</p>
<p>;;;;;;;;;;;;;;;;;;;;<br />
; Language Options ;<br />
;;;;;;;;;;;;;;;;;;;;</p>
<p>; Enable the PHP scripting language engine under Apache.<br />
engine = On</p>
<p>; Enable compatibility mode with Zend Engine 1 (PHP 4.x)<br />
zend.ze1_compatibility_mode = Off</p>
<p>; Allow the <? tag.? Otherwise, only <?php and <script> tags are recognized.<br />
; NOTE: Using short tags should be avoided when developing applications or<br />
; libraries that are meant for redistribution, or deployment on PHP<br />
; servers which are not under your control, because short tags may not<br />
; be supported on the target server. For portable, redistributable code,<br />
; be sure not to use short tags.<br />
short_open_tag = Off</p>
<p>; Allow ASP-style <% %> tags.<br />
asp_tags = Off</p>
<p>; The number of significant digits displayed in floating point numbers.<br />
precision??? =? 14</p>
<p>; Enforce year 2000 compliance (will cause problems with non-compliant browsers)<br />
y2k_compliance = On</p>
<p>; Output buffering allows you to send header lines (including cookies) even<br />
; after you send body content, at the price of slowing PHP's output layer a<br />
; bit.? You can enable output buffering during runtime by calling the output<br />
; buffering functions.? You can also enable output buffering for all files by<br />
; setting this directive to On.? If you wish to limit the size of the buffer<br />
; to a certain size - you can use a maximum number of bytes instead of 'On', as<br />
; a value for this directive (e.g., output_buffering=4096).<br />
output_buffering = 4096</p>
<p>; You can redirect all of the output of your scripts to a function.? For<br />
; example, if you set output_handler to "mb_output_handler", character<br />
; encoding will be transparently converted to the specified encoding.<br />
; Setting any output handler automatically turns on output buffering.<br />
; Note: People who wrote portable scripts should not depend on this ini<br />
;?????? directive. Instead, explicitly set the output handler using ob_start().<br />
;?????? Using this ini directive may cause problems unless you know what script<br />
;?????? is doing.<br />
; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"<br />
;?????? and you cannot use both "ob_gzhandler" and "zlib.output_compression".<br />
; Note: output_handler must be empty if this is set 'On' !!!!<br />
;?????? Instead you must use zlib.output_handler.<br />
;output_handler =</p>
<p>; Transparent output compression using the zlib library<br />
; Valid values for this option are 'off', 'on', or a specific buffer size<br />
; to be used for compression (default is 4KB)<br />
; Note: Resulting chunk size may vary due to nature of compression. PHP<br />
;?????? outputs chunks that are few hundreds bytes each as a result of<br />
;?????? compression. If you prefer a larger chunk size for better<br />
;?????? performance, enable output_buffering in addition.<br />
; Note: You need to use zlib.output_handler instead of the standard<br />
;?????? output_handler, or otherwise the output will be corrupted.<br />
zlib.output_compression = Off<br />
;zlib.output_compression_level = -1</p>
<p>; You cannot specify additional output handlers if zlib.output_compression<br />
; is activated here. This setting does the same as output_handler but in<br />
; a different order.<br />
;zlib.output_handler =</p>
<p>; Implicit flush tells PHP to tell the output layer to flush itself<br />
; automatically after every output block.? This is equivalent to calling the<br />
; PHP function flush() after each and every call to print() or echo() and each<br />
; and every HTML block.? Turning this option on has serious performance<br />
; implications and is generally recommended for debugging purposes only.<br />
implicit_flush = Off</p>
<p>; The unserialize callback function will be called (with the undefined class'<br />
; name as parameter), if the unserializer finds an undefined class<br />
; which should be instantiated.<br />
; A warning appears if the specified function is not defined, or if the<br />
; function doesn't include/implement the missing class.<br />
; So only set this entry, if you really want to implement such a<br />
; callback-function.<br />
unserialize_callback_func=</p>
<p>; When floats & doubles are serialized store serialize_precision significant<br />
; digits after the floating point. The default value ensures that when floats<br />
; are decoded with unserialize, the data will remain the same.<br />
serialize_precision = 100</p>
<p>; Whether to enable the ability to force arguments to be passed by reference<br />
; at function call time.? This method is deprecated and is likely to be<br />
; unsupported in future versions of PHP/Zend.? The encouraged method of<br />
; specifying which arguments should be passed by reference is in the function<br />
; declaration.? You're encouraged to try and turn this option Off and make<br />
; sure your scripts work properly with it in order to ensure they will work<br />
; with future versions of the language (you will receive a warning each time<br />
; you use this feature, and the argument will be passed by value instead of by<br />
; reference).<br />
allow_call_time_pass_reference = Off</p>
<p>;<br />
; Safe Mode<br />
;<br />
; SECURITY NOTE: The FreeBSD Security Officer strongly recommend that<br />
; the PHP Safe Mode feature not be relied upon for security, since the<br />
; issues Safe Mode tries to handle cannot properly be handled in PHP<br />
; (primarily due to PHP's use of external libraries).? While many bugs<br />
; in Safe Mode has been fixed it's very likely that more issues exist<br />
; which allows a user to bypass Safe Mode restrictions.<br />
; For increased security we recommend to always install the Suhosin<br />
; extension.<br />
;<br />
safe_mode = Off</p>
<p>; By default, Safe Mode does a UID compare check when<br />
; opening files. If you want to relax this to a GID compare,<br />
; then turn on safe_mode_gid.<br />
safe_mode_gid = Off</p>
<p>; When safe_mode is on, UID/GID checks are bypassed when<br />
; including files from this directory and its subdirectories.<br />
; (directory must also be in include_path or full path must<br />
; be used when including)<br />
safe_mode_include_dir =</p>
<p>; When safe_mode is on, only executables located in the safe_mode_exec_dir<br />
; will be allowed to be executed via the exec family of functions.<br />
safe_mode_exec_dir =</p>
<p>; Setting certain environment variables may be a potential security breach.<br />
; This directive contains a comma-delimited list of prefixes.? In Safe Mode,<br />
; the user may only alter environment variables whose names begin with the<br />
; prefixes supplied here.? By default, users will only be able to set<br />
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).<br />
;<br />
; Note:? If this directive is empty, PHP will let the user modify ANY<br />
; environment variable!<br />
safe_mode_allowed_env_vars = PHP_</p>
<p>; This directive contains a comma-delimited list of environment variables that<br />
; the end user won't be able to change using putenv().? These variables will be<br />
; protected even if safe_mode_allowed_env_vars is set to allow to change them.<br />
safe_mode_protected_env_vars = LD_LIBRARY_PATH</p>
<p>; open_basedir, if set, limits all file operations to the defined directory<br />
; and below.? This directive makes most sense if used in a per-directory<br />
; or per-virtualhost web server configuration file. This directive is<br />
; *NOT* affected by whether Safe Mode is turned On or Off.<br />
;open_basedir =</p>
<p>; This directive allows you to disable certain functions for security reasons.<br />
; It receives a comma-delimited list of function names. This directive is<br />
; *NOT* affected by whether Safe Mode is turned On or Off.<br />
disable_functions =</p>
<p>; This directive allows you to disable certain classes for security reasons.<br />
; It receives a comma-delimited list of class names. This directive is<br />
; *NOT* affected by whether Safe Mode is turned On or Off.<br />
disable_classes =</p>
<p>; Colors for Syntax Highlighting mode.? Anything that's acceptable in<br />
; <span style="color: ???????"> would work.<br />
;highlight.string? = #DD0000<br />
;highlight.comment = #FF9900<br />
;highlight.keyword = #007700<br />
;highlight.bg????? = #FFFFFF<br />
;highlight.default = #0000BB<br />
;highlight.html??? = #000000</p>
<p>; If enabled, the request will be allowed to complete even if the user aborts<br />
; the request. Consider enabling it if executing long request, which may end up<br />
; being interrupted by the user or a browser timing out.<br />
; ignore_user_abort = On</p>
<p>; Determines the size of the realpath cache to be used by PHP. This value should<br />
; be increased on systems where PHP opens many files to reflect the quantity of<br />
; the file operations performed.<br />
; realpath_cache_size=16k</p>
<p>; Duration of time, in seconds for which to cache realpath information for a given<br />
; file or directory. For systems with rarely changing files, consider increasing this<br />
; value.<br />
; realpath_cache_ttl=120</p>
<p>;<br />
; Misc<br />
;<br />
; Decides whether PHP may expose the fact that it is installed on the server<br />
; (e.g. by adding its signature to the Web server header).? It is no security<br />
; threat in any way, but it makes it possible to determine whether you use PHP<br />
; on your server or not.<br />
expose_php = On</p>
<p>;;;;;;;;;;;;;;;;;;;<br />
; Resource Limits ;<br />
;;;;;;;;;;;;;;;;;;;</p>
<p>max_execution_time = 30???? ; Maximum execution time of each script, in seconds<br />
max_input_time = 60???? ; Maximum amount of time each script may spend parsing request data<br />
;max_input_nesting_level = 64 ; Maximum input variable nesting level<br />
memory_limit = 128M????? ; Maximum amount of memory a script may consume (128MB)</p>
<p>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
; Error handling and logging ;<br />
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</p>
<p>; error_reporting is a bit-field.? Or each number up to get desired error<br />
; reporting level<br />
; E_ALL???????????? - All errors and warnings (doesn't include E_STRICT)<br />
; E_ERROR?????????? - fatal run-time errors<br />
; E_RECOVERABLE_ERROR? - almost fatal run-time errors<br />
; E_WARNING???????? - run-time warnings (non-fatal errors)<br />
; E_PARSE?????????? - compile-time parse errors<br />
; E_NOTICE????????? - run-time notices (these are warnings which often result<br />
;???????????????????? from a bug in your code, but it's possible that it was<br />
;???????????????????? intentional (e.g., using an uninitialized variable and<br />
;???????????????????? relying on the fact it's automatically initialized to an<br />
;???????????????????? empty string)<br />
; E_STRICT????????? - run-time notices, enable to have PHP suggest changes<br />
;???????????????????? to your code which will ensure the best interoperability<br />
;???????????????????? and forward compatibility of your code<br />
; E_CORE_ERROR????? - fatal errors that occur during PHP's initial startup<br />
; E_CORE_WARNING??? - warnings (non-fatal errors) that occur during PHP's<br />
;???????????????????? initial startup<br />
; E_COMPILE_ERROR?? - fatal compile-time errors<br />
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)<br />
; E_USER_ERROR????? - user-generated error message<br />
; E_USER_WARNING??? - user-generated warning message<br />
; E_USER_NOTICE???? - user-generated notice message<br />
;<br />
; Examples:<br />
;<br />
;?? - Show all errors, except for notices and coding standards warnings<br />
;<br />
;error_reporting = E_ALL & ~E_NOTICE<br />
;<br />
;?? - Show all errors, except for notices<br />
;<br />
;error_reporting = E_ALL & ~E_NOTICE | E_STRICT<br />
;<br />
;?? - Show only errors<br />
;<br />
;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR<br />
;<br />
;?? - Show all errors, except coding standards warnings<br />
;<br />
error_reporting = E_ALL</p>
<p>; Print out errors (as a part of the output).? For production web sites,<br />
; you're strongly encouraged to turn this feature off, and use error logging<br />
; instead (see below).? Keeping display_errors enabled on a production web site<br />
; may reveal security information to end users, such as file paths on your Web<br />
; server, your database schema or other information.<br />
;<br />
; possible values for display_errors:<br />
;<br />
; Off????????? - Do not display any errors<br />
; stderr?????? - Display errors to STDERR (affects only CGI/CLI binaries!)<br />
; On or stdout - Display errors to STDOUT (default)<br />
;<br />
; To output errors to STDERR with CGI/CLI:<br />
;display_errors = "stderr"<br />
;<br />
; Default<br />
;<br />
display_errors = Off</p>
<p>; Even when display_errors is on, errors that occur during PHP's startup<br />
; sequence are not displayed.? It's strongly recommended to keep<br />
; display_startup_errors off, except for when debugging.<br />
display_startup_errors = Off</p>
<p>; Log errors into a log file (server-specific log, stderr, or error_log (below))<br />
; As stated above, you're strongly advised to use error logging in place of<br />
; error displaying on production web sites.<br />
log_errors = On</p>
<p>; Set maximum length of log_errors. In error_log information about the source is<br />
; added. The default is 1024 and 0 allows to not apply any maximum length at all.<br />
log_errors_max_len = 1024</p>
<p>; Do not log repeated messages. Repeated errors must occur in same file on same<br />
; line unless ignore_repeated_source is set true.<br />
ignore_repeated_errors = Off</p>
<p>; Ignore source of message when ignoring repeated messages. When this setting<br />
; is On you will not log errors with repeated messages from different files or<br />
; source lines.<br />
ignore_repeated_source = Off</p>
<p>; If this parameter is set to Off, then memory leaks will not be shown (on<br />
; stdout or in the log). This has only effect in a debug compile, and if<br />
; error reporting includes E_WARNING in the allowed list<br />
report_memleaks = On</p>
<p>;report_zend_debug = 0</p>
<p>; Store the last error/warning message in $php_errormsg (boolean).<br />
track_errors = Off</p>
<p>; Turn off normal error reporting and emit XML-RPC error XML<br />
;xmlrpc_errors = 0<br />
; An XML-RPC faultCode<br />
;xmlrpc_error_number = 0</p>
<p>; Disable the inclusion of HTML tags in error messages.<br />
; Note: Never use this feature for production boxes.<br />
;html_errors = Off</p>
<p>; If html_errors is set On PHP produces clickable error messages that direct<br />
; to a page describing the error or function causing the error in detail.<br />
; You can download a copy of the PHP manual from http://www.php.net/docs.php<br />
; and change docref_root to the base URL of your local copy including the<br />
; leading '/'. You must also specify the file extension being used including<br />
; the dot.<br />
; Note: Never use this feature for production boxes.<br />
;docref_root = "/phpmanual/"<br />
;docref_ext = .html</p>
<p>; String to output before an error message.<br />
;error_prepend_string = "<font color=#ff0000>"</p>
<p>; String to output after an error message.<br />
;error_append_string = "</font>"</p>
<p>; Log errors to specified file.<br />
;error_log = filename</p>
<p>; Log errors to syslog (Event Log on NT, not valid in Windows 95).<br />
;error_log = syslog</p>
<p>;;;;;;;;;;;;;;;;;<br />
; Data Handling ;<br />
;;;;;;;;;;;;;;;;;<br />
;<br />
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3</p>
<p>; The separator used in PHP generated URLs to separate arguments.<br />
; Default is "&".<br />
;arg_separator.output = "&"</p>
<p>; List of separator(s) used by PHP to parse input URLs into variables.<br />
; Default is "&".<br />
; NOTE: Every character in this directive is considered as separator!<br />
;arg_separator.input = ";&"</p>
<p>; This directive describes the order in which PHP registers GET, POST, Cookie,<br />
; Environment and Built-in variables (G, P, C, E & S respectively, often<br />
; referred to as EGPCS or GPC).? Registration is done from left to right, newer<br />
; values override older values.<br />
variables_order = "GPCS"</p>
<p>; Whether or not to register the EGPCS variables as global variables.? You may<br />
; want to turn this off if you don't want to clutter your scripts' global scope<br />
; with user data.? This makes most sense when coupled with track_vars - in which<br />
; case you can access all of the GPC variables through the $HTTP_*_VARS[],<br />
; variables.<br />
;<br />
; You should do your best to write your scripts so that they do not require<br />
; register_globals to be on;? Using form variables as globals can easily lead<br />
; to possible security problems, if the code is not very well thought of.<br />
register_globals = Off</p>
<p>; Whether or not to register the old-style input arrays, HTTP_GET_VARS<br />
; and friends.? If you're not using them, it's recommended to turn them off,<br />
; for performance reasons.<br />
register_long_arrays = Off</p>
<p>; This directive tells PHP whether to declare the argv&argc variables (that<br />
; would contain the GET information).? If you don't use these variables, you<br />
; should turn it off for increased performance.<br />
register_argc_argv = Off</p>
<p>; When enabled, the SERVER and ENV variables are created when they're first<br />
; used (Just In Time) instead of when the script starts. If these variables<br />
; are not used within a script, having this directive on will result in a<br />
; performance gain. The PHP directives register_globals, register_long_arrays,<br />
; and register_argc_argv must be disabled for this directive to have any affect.<br />
auto_globals_jit = On</p>
<p>; Maximum size of POST data that PHP will accept.<br />
post_max_size = 8M</p>
<p>; Magic quotes<br />
;</p>
<p>; Magic quotes for incoming GET/POST/Cookie data.<br />
magic_quotes_gpc = Off</p>
<p>; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.<br />
magic_quotes_runtime = Off</p>
<p>; Use Sybase-style magic quotes (escape ' with '' instead of \').<br />
magic_quotes_sybase = Off</p>
<p>; Automatically add files before or after any PHP document.<br />
auto_prepend_file =<br />
auto_append_file =</p>
<p>; As of 4.0b4, PHP always outputs a character encoding by default in<br />
; the Content-type: header.? To disable sending of the charset, simply<br />
; set it to be empty.<br />
;<br />
; PHP's built-in default is text/html<br />
default_mimetype = "text/html"<br />
;default_charset = "iso-8859-1"</p>
<p>; Always populate the $HTTP_RAW_POST_DATA variable.<br />
;always_populate_raw_post_data = On</p>
<p>;;;;;;;;;;;;;;;;;;;;;;;;;<br />
; Paths and Directories ;<br />
;;;;;;;;;;;;;;;;;;;;;;;;;</p>
<p>; UNIX: "/path1:/path2"<br />
;include_path = ".:/php/includes"<br />
;<br />
; Windows: "\path1;\path2"<br />
;include_path = ".;c:\php\includes"</p>
<p>; The root of the PHP pages, used only if nonempty.<br />
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root<br />
; if you are running php as a CGI under any web server (other than IIS)<br />
; see documentation for security issues.? The alternate is to use the<br />
; cgi.force_redirect configuration below<br />
doc_root =</p>
<p>; The directory under which PHP opens the script using /~username used only<br />
; if nonempty.<br />
user_dir =</p>
<p>; Directory in which the loadable extensions (modules) reside.<br />
; extension_dir = "./"</p>
<p>; Whether or not to enable the dl() function.? The dl() function does NOT work<br />
; properly in multithreaded servers, such as IIS or Zeus, and is automatically<br />
; disabled on them.<br />
enable_dl = On</p>
<p>; cgi.force_redirect is necessary to provide security running PHP as a CGI under<br />
; most web servers.? Left undefined, PHP turns this on by default.? You can<br />
; turn it off here AT YOUR OWN RISK<br />
; **You CAN safely turn this off for IIS, in fact, you MUST.**<br />
; cgi.force_redirect = 1</p>
<p>; if cgi.nph is enabled it will force cgi to always sent Status: 200 with<br />
; every request.<br />
; cgi.nph = 1</p>
<p>; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape<br />
; (iPlanet) web servers, you MAY need to set an environment variable name that PHP<br />
; will look for to know it is OK to continue execution.? Setting this variable MAY<br />
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.<br />
; cgi.redirect_status_env = ;</p>
<p>; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.? PHP's<br />
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok<br />
; what PATH_INFO is.? For more information on PATH_INFO, see the cgi specs.? Setting<br />
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec.? A setting<br />
; of zero causes PHP to behave as before.? Default is 1.? You should fix your scripts<br />
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.<br />
; cgi.fix_pathinfo=1</p>
<p>; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate<br />
; security tokens of the calling client.? This allows IIS to define the<br />
; security context that the request runs under.? mod_fastcgi under Apache<br />
; does not currently support this feature (03/17/2002)<br />
; Set to 1 if running under IIS.? Default is zero.<br />
; fastcgi.impersonate = 1;</p>
<p>; Disable logging through FastCGI connection<br />
; fastcgi.logging = 0</p>
<p>; cgi.rfc2616_headers configuration option tells PHP what type of headers to<br />
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that<br />
; is supported by Apache. When this option is set to 1 PHP will send<br />
; RFC2616 compliant header.<br />
; Default is zero.<br />
;cgi.rfc2616_headers = 0</p>
<p>;;;;;;;;;;;;;;;;<br />
; File Uploads ;<br />
;;;;;;;;;;;;;;;;</p>
<p>; Whether to allow HTTP file uploads.<br />
file_uploads = On</p>
<p>; Temporary directory for HTTP uploaded files (will use system default if not<br />
; specified).<br />
;upload_tmp_dir =</p>
<p>; Maximum allowed size for uploaded files.<br />
upload_max_filesize = 10M</p>
<p>;;;;;;;;;;;;;;;;;;<br />
; Fopen wrappers ;<br />
;;;;;;;;;;;;;;;;;;</p>
<p>; Whether to allow the treatment of URLs (like http:// or ftp://) as files.<br />
allow_url_fopen = On</p>
<p>; Whether to allow include/require to open URLs (like http:// or ftp://) as files.<br />
allow_url_include = Off</p>
<p>; Define the anonymous ftp password (your email address)<br />
;from="john@doe.com"</p>
<p>; Define the User-Agent string<br />
; user_agent="PHP"</p>
<p>; Default timeout for socket based streams (seconds)<br />
default_socket_timeout = 60</p>
<p>; If your scripts have to deal with files from Macintosh systems,<br />
; or you are running on a Mac and need to deal with files from<br />
; unix or win32 systems, setting this flag will cause PHP to<br />
; automatically detect the EOL character in those files so that<br />
; fgets() and file() will work regardless of the source of the file.<br />
; auto_detect_line_endings = Off</p>
<p>;;;;;;;;;;;;;;;;;;;;;;<br />
; Dynamic Extensions ;<br />
;;;;;;;;;;;;;;;;;;;;;;<br />
;<br />
; If you wish to have an extension loaded automatically, use the following<br />
; syntax:<br />
;<br />
;?? extension=modulename.extension<br />
;<br />
; For example, on Windows:<br />
;<br />
;?? extension=msql.dll<br />
;<br />
; ... or under UNIX:<br />
;<br />
;?? extension=msql.so<br />
;<br />
; Note that it should be the name of the module only; no directory information<br />
; needs to go here.? Specify the location of the extension with the<br />
; extension_dir directive above.</p>
<p>; Windows Extensions<br />
; Note that ODBC support is built in, so no dll is needed for it.<br />
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)<br />
; extension folders as well as the separate PECL DLL download (PHP 5).<br />
; Be sure to appropriately set the extension_dir directive.</p>
<p>;extension=php_bz2.dll<br />
;extension=php_curl.dll<br />
;extension=php_dba.dll<br />
;extension=php_dbase.dll<br />
extension=php_exif.dll<br />
;extension=php_fdf.dll<br />
extension=php_gd2.dll<br />
extension=php_gettext.dll<br />
;extension=php_gmp.dll<br />
;extension=php_ifx.dll<br />
extension=php_imap.dll<br />
;extension=php_interbase.dll<br />
;extension=php_ldap.dll<br />
;extension=php_mbstring.dll<br />
;extension=php_mcrypt.dll<br />
;extension=php_mhash.dll<br />
;extension=php_mime_magic.dll<br />
;extension=php_ming.dll<br />
;extension=php_msql.dll<br />
;extension=php_mssql.dll<br />
extension=php_mysql.dll<br />
;extension=php_mysqli.dll<br />
;extension=php_oci8.dll<br />
extension=php_openssl.dll<br />
;extension=php_pdo.dll<br />
;extension=php_pdo_firebird.dll<br />
;extension=php_pdo_mssql.dll<br />
;extension=php_pdo_mysql.dll<br />
;extension=php_pdo_oci.dll<br />
;extension=php_pdo_oci8.dll<br />
;extension=php_pdo_odbc.dll<br />
;extension=php_pdo_pgsql.dll<br />
;extension=php_pdo_sqlite.dll<br />
;extension=php_pgsql.dll<br />
;extension=php_pspell.dll<br />
;extension=php_shmop.dll<br />
;extension=php_snmp.dll<br />
;extension=php_soap.dll<br />
;extension=php_sockets.dll<br />
;extension=php_sqlite.dll<br />
;extension=php_sybase_ct.dll<br />
;extension=php_tidy.dll<br />
;extension=php_xmlrpc.dll<br />
;extension=php_xsl.dll<br />
;extension=php_zip.dll</p>
<p>;;;;;;;;;;;;;;;;;;;<br />
; Module Settings ;<br />
;;;;;;;;;;;;;;;;;;;</p>
<p>[Date]<br />
; Defines the default timezone used by the date functions<br />
;date.timezone =</p>
<p>;date.default_latitude = 31.7667<br />
;date.default_longitude = 35.2333</p>
<p>;date.sunrise_zenith = 90.583333<br />
;date.sunset_zenith = 90.583333</p>
<p>[filter]<br />
;filter.default = unsafe_raw<br />
;filter.default_flags =</p>
<p>[iconv]<br />
;iconv.input_encoding = ISO-8859-1<br />
;iconv.internal_encoding = ISO-8859-1<br />
;iconv.output_encoding = ISO-8859-1</p>
<p>[sqlite]<br />
;sqlite.assoc_case = 0</p>
<p>[Pcre]<br />
;PCRE library backtracking limit.<br />
;pcre.backtrack_limit=100000</p>
<p>;PCRE library recursion limit.<br />
;Please note that if you set this value to a high number you may consume all<br />
;the available process stack and eventually crash PHP (due to reaching the<br />
;stack size limit imposed by the Operating System).<br />
;pcre.recursion_limit=100000</p>
<p>[Syslog]<br />
; Whether or not to define the various syslog variables (e.g. $LOG_PID,<br />
; $LOG_CRON, etc.).? Turning it off is a good idea performance-wise.? In<br />
; runtime, you can define these variables by calling define_syslog_variables().<br />
define_syslog_variables? = Off</p>
<p>[mail function]<br />
; For Win32 only.<br />
SMTP = localhost<br />
smtp_port = 25</p>
<p>; For Win32 only.<br />
;sendmail_from = me@example.com</p>
<p>; For Unix only.? You may supply arguments as well (default: "sendmail -t -i").<br />
;sendmail_path =</p>
<p>; Force the addition of the specified parameters to be passed as extra parameters<br />
; to the sendmail binary. These parameters will always replace the value of<br />
; the 5th parameter to mail(), even in safe mode.<br />
;mail.force_extra_parameters =</p>
<p>[SQL]<br />
sql.safe_mode = Off</p>
<p>[ODBC]<br />
;odbc.default_db??? =? Not yet implemented<br />
;odbc.default_user? =? Not yet implemented<br />
;odbc.default_pw??? =? Not yet implemented</p>
<p>; Allow or prevent persistent links.<br />
odbc.allow_persistent = On</p>
<p>; Check that a connection is still valid before reuse.<br />
odbc.check_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
odbc.max_persistent = -1</p>
<p>; Maximum number of links (persistent + non-persistent).? -1 means no limit.<br />
odbc.max_links = -1</p>
<p>; Handling of LONG fields.? Returns number of bytes to variables.? 0 means<br />
; passthru.<br />
odbc.defaultlrl = 4096</p>
<p>; Handling of binary data.? 0 means passthru, 1 return as is, 2 convert to char.<br />
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation<br />
; of uodbc.defaultlrl and uodbc.defaultbinmode<br />
odbc.defaultbinmode = 1</p>
<p>[MySQL]<br />
; Allow or prevent persistent links.<br />
mysql.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
mysql.max_persistent = -1</p>
<p>; Maximum number of links (persistent + non-persistent).? -1 means no limit.<br />
mysql.max_links = -1</p>
<p>; Default port number for mysql_connect().? If unset, mysql_connect() will use<br />
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the<br />
; compile-time value defined MYSQL_PORT (in that order).? Win32 will only look<br />
; at MYSQL_PORT.<br />
mysql.default_port =</p>
<p>; Default socket name for local MySQL connects.? If empty, uses the built-in<br />
; MySQL defaults.<br />
mysql.default_socket =</p>
<p>; Default host for mysql_connect() (doesn't apply in safe mode).<br />
mysql.default_host =</p>
<p>; Default user for mysql_connect() (doesn't apply in safe mode).<br />
mysql.default_user =</p>
<p>; Default password for mysql_connect() (doesn't apply in safe mode).<br />
; Note that this is generally a *bad* idea to store passwords in this file.<br />
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")<br />
; and reveal this password!? And of course, any users with read access to this<br />
; file will be able to reveal the password as well.<br />
mysql.default_password =</p>
<p>; Maximum time (in seconds) for connect timeout. -1 means no limit<br />
mysql.connect_timeout = 60</p>
<p>; Trace mode. When trace_mode is active (=On), warnings for table/index scans and<br />
; SQL-Errors will be displayed.<br />
mysql.trace_mode = Off</p>
<p>[MySQLi]</p>
<p>; Maximum number of links.? -1 means no limit.<br />
mysqli.max_links = -1</p>
<p>; Default port number for mysqli_connect().? If unset, mysqli_connect() will use<br />
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the<br />
; compile-time value defined MYSQL_PORT (in that order).? Win32 will only look<br />
; at MYSQL_PORT.<br />
mysqli.default_port = 3306</p>
<p>; Default socket name for local MySQL connects.? If empty, uses the built-in<br />
; MySQL defaults.<br />
mysqli.default_socket =</p>
<p>; Default host for mysql_connect() (doesn't apply in safe mode).<br />
mysqli.default_host =</p>
<p>; Default user for mysql_connect() (doesn't apply in safe mode).<br />
mysqli.default_user =</p>
<p>; Default password for mysqli_connect() (doesn't apply in safe mode).<br />
; Note that this is generally a *bad* idea to store passwords in this file.<br />
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")<br />
; and reveal this password!? And of course, any users with read access to this<br />
; file will be able to reveal the password as well.<br />
mysqli.default_pw =</p>
<p>; Allow or prevent reconnect<br />
mysqli.reconnect = Off</p>
<p>[mSQL]<br />
; Allow or prevent persistent links.<br />
msql.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
msql.max_persistent = -1</p>
<p>; Maximum number of links (persistent+non persistent).? -1 means no limit.<br />
msql.max_links = -1</p>
<p>[OCI8]<br />
; enables privileged connections using external credentials (OCI_SYSOPER, OCI_SYSDBA)<br />
;oci8.privileged_connect = Off</p>
<p>; Connection: The maximum number of persistent OCI8 connections per<br />
; process. Using -1 means no limit.<br />
;oci8.max_persistent = -1</p>
<p>; Connection: The maximum number of seconds a process is allowed to<br />
; maintain an idle persistent connection. Using -1 means idle<br />
; persistent connections will be maintained forever.<br />
;oci8.persistent_timeout = -1</p>
<p>; Connection: The number of seconds that must pass before issuing a<br />
; ping during oci_pconnect() to check the connection validity. When<br />
; set to 0, each oci_pconnect() will cause a ping. Using -1 disables<br />
; pings completely.<br />
;oci8.ping_interval = 60</p>
<p>; Tuning: This option enables statement caching, and specifies how<br />
; many statements to cache. Using 0 disables statement caching.<br />
;oci8.statement_cache_size = 20</p>
<p>; Tuning: Enables statement prefetching and sets the default number of<br />
; rows that will be fetched automatically after statement execution.<br />
;oci8.default_prefetch = 10</p>
<p>; Compatibility. Using On means oci_close() will not close<br />
; oci_connect() and oci_new_connect() connections.<br />
;oci8.old_oci_close_semantics = Off</p>
<p>[PostgresSQL]<br />
; Allow or prevent persistent links.<br />
pgsql.allow_persistent = On</p>
<p>; Detect broken persistent links always with pg_pconnect().<br />
; Auto reset feature requires a little overheads.<br />
pgsql.auto_reset_persistent = Off</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
pgsql.max_persistent = -1</p>
<p>; Maximum number of links (persistent+non persistent).? -1 means no limit.<br />
pgsql.max_links = -1</p>
<p>; Ignore PostgreSQL backends Notice message or not.<br />
; Notice message logging require a little overheads.<br />
pgsql.ignore_notice = 0</p>
<p>; Log PostgreSQL backends Notice message or not.<br />
; Unless pgsql.ignore_notice=0, module cannot log notice message.<br />
pgsql.log_notice = 0</p>
<p>[Sybase]<br />
; Allow or prevent persistent links.<br />
sybase.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
sybase.max_persistent = -1</p>
<p>; Maximum number of links (persistent + non-persistent).? -1 means no limit.<br />
sybase.max_links = -1</p>
<p>;sybase.interface_file = "/usr/sybase/interfaces"</p>
<p>; Minimum error severity to display.<br />
sybase.min_error_severity = 10</p>
<p>; Minimum message severity to display.<br />
sybase.min_message_severity = 10</p>
<p>; Compatibility mode with old versions of PHP 3.0.<br />
; If on, this will cause PHP to automatically assign types to results according<br />
; to their Sybase type, instead of treating them all as strings.? This<br />
; compatibility mode will probably not stay around forever, so try applying<br />
; whatever necessary changes to your code, and turn it off.<br />
sybase.compatability_mode = Off</p>
<p>[Sybase-CT]<br />
; Allow or prevent persistent links.<br />
sybct.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
sybct.max_persistent = -1</p>
<p>; Maximum number of links (persistent + non-persistent).? -1 means no limit.<br />
sybct.max_links = -1</p>
<p>; Minimum server message severity to display.<br />
sybct.min_server_severity = 10</p>
<p>; Minimum client message severity to display.<br />
sybct.min_client_severity = 10</p>
<p>[bcmath]<br />
; Number of decimal digits for all bcmath functions.<br />
bcmath.scale = 0</p>
<p>[browscap]<br />
;browscap = extra/browscap.ini</p>
<p>[Informix]<br />
; Default host for ifx_connect() (doesn't apply in safe mode).<br />
ifx.default_host =</p>
<p>; Default user for ifx_connect() (doesn't apply in safe mode).<br />
ifx.default_user =</p>
<p>; Default password for ifx_connect() (doesn't apply in safe mode).<br />
ifx.default_password =</p>
<p>; Allow or prevent persistent links.<br />
ifx.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
ifx.max_persistent = -1</p>
<p>; Maximum number of links (persistent + non-persistent).? -1 means no limit.<br />
ifx.max_links = -1</p>
<p>; If on, select statements return the contents of a text blob instead of its id.<br />
ifx.textasvarchar = 0</p>
<p>; If on, select statements return the contents of a byte blob instead of its id.<br />
ifx.byteasvarchar = 0</p>
<p>; Trailing blanks are stripped from fixed-length char columns.? May help the<br />
; life of Informix SE users.<br />
ifx.charasvarchar = 0</p>
<p>; If on, the contents of text and byte blobs are dumped to a file instead of<br />
; keeping them in memory.<br />
ifx.blobinfile = 0</p>
<p>; NULL's are returned as empty strings, unless this is set to 1.? In that case,<br />
; NULL's are returned as string 'NULL'.<br />
ifx.nullformat = 0</p>
<p>[Session]<br />
; Handler used to store/retrieve data.<br />
session.save_handler = files</p>
<p>; Argument passed to save_handler.? In the case of files, this is the path<br />
; where data files are stored. Note: Windows users have to change this<br />
; variable in order to use PHP's session functions.<br />
;<br />
; As of PHP 4.0.1, you can define the path as:<br />
;<br />
;???? session.save_path = "N;/path"<br />
;<br />
; where N is an integer.? Instead of storing all the session files in<br />
; /path, what this will do is use subdirectories N-levels deep, and<br />
; store the session data in those directories.? This is useful if you<br />
; or your OS have problems with lots of files in one directory, and is<br />
; a more efficient layout for servers that handle lots of sessions.<br />
;<br />
; NOTE 1: PHP will not create this directory structure automatically.<br />
;???????? You can use the script in the ext/session dir for that purpose.<br />
; NOTE 2: See the section on garbage collection below if you choose to<br />
;???????? use subdirectories for session storage<br />
;<br />
; The file storage module creates files using mode 600 by default.<br />
; You can change that by using<br />
;<br />
;???? session.save_path = "N;MODE;/path"<br />
;<br />
; where MODE is the octal representation of the mode. Note that this<br />
; does not overwrite the process's umask.<br />
;session.save_path = "/tmp"</p>
<p>; Whether to use cookies.<br />
session.use_cookies = 1</p>
<p>;session.cookie_secure =</p>
<p>; This option enables administrators to make their users invulnerable to<br />
; attacks which involve passing session ids in URLs; defaults to 0.<br />
; session.use_only_cookies = 1</p>
<p>; Name of the session (used as cookie name).<br />
session.name = PHPSESSID</p>
<p>; Initialize session on request startup.<br />
session.auto_start = 0</p>
<p>; Lifetime in seconds of cookie or, if 0, until browser is restarted.<br />
session.cookie_lifetime = 0</p>
<p>; The path for which the cookie is valid.<br />
session.cookie_path = /</p>
<p>; The domain for which the cookie is valid.<br />
session.cookie_domain =</p>
<p>; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.<br />
session.cookie_httponly =</p>
<p>; Handler used to serialize data.? php is the standard serializer of PHP.<br />
session.serialize_handler = php</p>
<p>; Define the probability that the 'garbage collection' process is started<br />
; on every session initialization.<br />
; The probability is calculated by using gc_probability/gc_divisor,<br />
; e.g. 1/100 means there is a 1% chance that the GC process starts<br />
; on each request.</p>
<p>session.gc_probability = 1<br />
session.gc_divisor???? = 1000</p>
<p>; After this number of seconds, stored data will be seen as 'garbage' and<br />
; cleaned up by the garbage collection process.<br />
session.gc_maxlifetime = 1440</p>
<p>; NOTE: If you are using the subdirectory option for storing session files<br />
;?????? (see session.save_path above), then garbage collection does *not*<br />
;?????? happen automatically.? You will need to do your own garbage<br />
;?????? collection through a shell script, cron entry, or some other method.<br />
;?????? For example, the following script would is the equivalent of<br />
;?????? setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):<br />
;????????? cd /path/to/sessions; find -cmin +24 | xargs rm</p>
<p>; PHP 4.2 and less have an undocumented feature/bug that allows you to<br />
; to initialize a session variable in the global scope, albeit register_globals<br />
; is disabled.? PHP 4.3 and later will warn you, if this feature is used.<br />
; You can disable the feature and the warning separately. At this time,<br />
; the warning is only displayed, if bug_compat_42 is enabled.</p>
<p>session.bug_compat_42 = 0<br />
session.bug_compat_warn = 1</p>
<p>; Check HTTP Referer to invalidate externally stored URLs containing ids.<br />
; HTTP_REFERER has to contain this substring for the session to be<br />
; considered as valid.<br />
session.referer_check =</p>
<p>; How many bytes to read from the file.<br />
session.entropy_length = 0</p>
<p>; Specified here to create the session id.<br />
session.entropy_file =</p>
<p>;session.entropy_length = 16</p>
<p>;session.entropy_file = /dev/urandom</p>
<p>; Set to {nocache,private,public,} to determine HTTP caching aspects<br />
; or leave this empty to avoid sending anti-caching headers.<br />
session.cache_limiter = nocache</p>
<p>; Document expires after n minutes.<br />
session.cache_expire = 180</p>
<p>; trans sid support is disabled by default.<br />
; Use of trans sid may risk your users security.<br />
; Use this option with caution.<br />
; - User may send URL contains active session ID<br />
;?? to other person via. email/irc/etc.<br />
; - URL that contains active session ID may be stored<br />
;?? in publically accessible computer.<br />
; - User may access your site with the same session ID<br />
;?? always using URL stored in browser's history or bookmarks.<br />
session.use_trans_sid = 0</p>
<p>; Select a hash function<br />
; 0: MD5?? (128 bits)<br />
; 1: SHA-1 (160 bits)<br />
session.hash_function = 0</p>
<p>; Define how many bits are stored in each character when converting<br />
; the binary hash data to something readable.<br />
;<br />
; 4 bits: 0-9, a-f<br />
; 5 bits: 0-9, a-v<br />
; 6 bits: 0-9, a-z, A-Z, "-", ","<br />
session.hash_bits_per_character = 5</p>
<p>; The URL rewriter will look for URLs in a defined set of HTML tags.<br />
; form/fieldset are special; if you include them here, the rewriter will<br />
; add a hidden <input> field with the info which is otherwise appended<br />
; to URLs.? If you want XHTML conformity, remove the form entry.<br />
; Note that all valid entries require a "=", even if no value follows.<br />
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"</p>
<p>[MSSQL]<br />
; Allow or prevent persistent links.<br />
mssql.allow_persistent = On</p>
<p>; Maximum number of persistent links.? -1 means no limit.<br />
mssql.max_persistent = -1</p>
<p>; Maximum number of links (persistent+non persistent).? -1 means no limit.<br />
mssql.max_links = -1</p>
<p>; Minimum error severity to display.<br />
mssql.min_error_severity = 10</p>
<p>; Minimum message severity to display.<br />
mssql.min_message_severity = 10</p>
<p>; Compatibility mode with old versions of PHP 3.0.<br />
mssql.compatability_mode = Off</p>
<p>; Connect timeout<br />
;mssql.connect_timeout = 5</p>
<p>; Query timeout<br />
;mssql.timeout = 60</p>
<p>; Valid range 0 - 2147483647.? Default = 4096.<br />
;mssql.textlimit = 4096</p>
<p>; Valid range 0 - 2147483647.? Default = 4096.<br />
;mssql.textsize = 4096</p>
<p>; Limits the number of records in each batch.? 0 = all records in one batch.<br />
;mssql.batchsize = 0</p>
<p>; Specify how datetime and datetim4 columns are returned<br />
; On => Returns data converted to SQL server settings<br />
; Off => Returns values as YYYY-MM-DD hh:mm:ss<br />
;mssql.datetimeconvert = On</p>
<p>; Use NT authentication when connecting to the server<br />
mssql.secure_connection = Off</p>
<p>; Specify max number of processes. -1 = library default<br />
; msdlib defaults to 25<br />
; FreeTDS defaults to 4096<br />
;mssql.max_procs = -1</p>
<p>; Specify client character set.<br />
; If empty or not set the client charset from freetds.comf is used<br />
; This is only used when compiled with FreeTDS<br />
;mssql.charset = "ISO-8859-1"</p>
<p>[Assertion]<br />
; Assert(expr); active by default.<br />
;assert.active = On</p>
<p>; Issue a PHP warning for each failed assertion.<br />
;assert.warning = On</p>
<p>; Don't bail out by default.<br />
;assert.bail = Off</p>
<p>; User-function to be called if an assertion fails.<br />
;assert.callback = 0</p>
<p>; Eval the expression with current error_reporting().? Set to true if you want<br />
; error_reporting(0) around the eval().<br />
;assert.quiet_eval = 0</p>
<p>[COM]<br />
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs<br />
;com.typelib_file =<br />
; allow Distributed-COM calls<br />
;com.allow_dcom = true<br />
; autoregister constants of a components typlib on com_load()<br />
;com.autoregister_typelib = true<br />
; register constants casesensitive<br />
;com.autoregister_casesensitive = false<br />
; show warnings on duplicate constant registrations<br />
;com.autoregister_verbose = true</p>
<p>[mbstring]<br />
; language for internal character representation.<br />
;mbstring.language = Japanese</p>
<p>; internal/script encoding.<br />
; Some encoding cannot work as internal encoding.<br />
; (e.g. SJIS, BIG5, ISO-2022-*)<br />
;mbstring.internal_encoding = EUC-JP</p>
<p>; http input encoding.<br />
;mbstring.http_input = auto</p>
<p>; http output encoding. mb_output_handler must be<br />
; registered as output buffer to function<br />
;mbstring.http_output = SJIS</p>
<p>; enable automatic encoding translation according to<br />
; mbstring.internal_encoding setting. Input chars are<br />
; converted to internal encoding by setting this to On.<br />
; Note: Do _not_ use automatic encoding translation for<br />
;?????? portable libs/applications.<br />
;mbstring.encoding_translation = Off</p>
<p>; automatic encoding detection order.<br />
; auto means<br />
;mbstring.detect_order = auto</p>
<p>; substitute_character used when character cannot be converted<br />
; one from another<br />
;mbstring.substitute_character = none;</p>
<p>; overload(replace) single byte functions by mbstring functions.<br />
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),<br />
; etc. Possible values are 0,1,2,4 or combination of them.<br />
; For example, 7 for overload everything.<br />
; 0: No overload<br />
; 1: Overload mail() function<br />
; 2: Overload str*() functions<br />
; 4: Overload ereg*() functions<br />
;mbstring.func_overload = 0</p>
<p>; enable strict encoding detection.<br />
;mbstring.strict_detection = Off</p>
<p>[FrontBase]<br />
;fbsql.allow_persistent = On<br />
;fbsql.autocommit = On<br />
;fbsql.show_timestamp_decimals = Off<br />
;fbsql.default_database =<br />
;fbsql.default_database_password =<br />
;fbsql.default_host =<br />
;fbsql.default_password =<br />
;fbsql.default_user = "_SYSTEM"<br />
;fbsql.generate_warnings = Off<br />
;fbsql.max_connections = 128<br />
;fbsql.max_links = 128<br />
;fbsql.max_persistent = -1<br />
;fbsql.max_results = 128</p>
<p>[gd]<br />
; Tell the jpeg decode to libjpeg warnings and try to create<br />
; a gd image. The warning will then be displayed as notices<br />
; disabled by default<br />
;gd.jpeg_ignore_warning = 0</p>
<p>[exif]<br />
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.<br />
; With mbstring support this will automatically be converted into the encoding<br />
; given by corresponding encode setting. When empty mbstring.internal_encoding<br />
; is used. For the decode settings you can distinguish between motorola and<br />
; intel byte order. A decode setting cannot be empty.<br />
;exif.encode_unicode = ISO-8859-15<br />
;exif.decode_unicode_motorola = UCS-2BE<br />
;exif.decode_unicode_intel??? = UCS-2LE<br />
;exif.encode_jis =<br />
;exif.decode_jis_motorola = JIS<br />
;exif.decode_jis_intel??? = JIS</p>
<p>[Tidy]<br />
; The path to a default tidy configuration file to use when using tidy<br />
;tidy.default_config = /usr/local/lib/php/default.tcfg</p>
<p>; Should tidy clean and repair output automatically?<br />
; WARNING: Do not use this option if you are generating non-html content<br />
; such as dynamic images<br />
tidy.clean_output = Off</p>
<p>[soap]<br />
; Enables or disables WSDL caching feature.<br />
soap.wsdl_cache_enabled=1<br />
; Sets the directory name where SOAP extension will put cache files.<br />
soap.wsdl_cache_dir="/tmp"<br />
; (time to live) Sets the number of second while cached file will be used<br />
; instead of original one.<br />
soap.wsdl_cache_ttl=86400</p>
<p>; Local Variables:<br />
; tab-width: 4<br />
; End:</p>
<p>

Wordpress

The last part is to actually install Wordpress. You can accomplish this one of two ways, first you could install it from your package management system (If you are lucky enough to have a decent management system that is quite complete) or second you could just download the tarball from the Wordpress web site and extract it in your apache document root. Both ways have advantages and disadvantages but I kind of like just doing the tarball install as web applications always seem to come with self updaters that would not mix well with traditional package management (Files would get changed by the web application updater and this would confuse the package management system).

Now, just point your broswer to http://yourhosthere.com/wp-admin/install.php and follow the on screen instructions. There’s more information available on the Wordpress install tutorial. You may want to read that if anything is not working properly.

OpenWRT kicks ass

I have been using openwrt for quite a while now (about a year I think) and it is the best router firmware I have ever used. Right now my WRT54G has been up for over 57 days:

kyle ~/Projects/enc $  ssh wrt
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (8.09, r14511) ----------------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@wrt ~ #  uptime
 14:56:11 up 57 days,  3:35, load average: 0.01, 0.02, 0.00
root@wrt ~ #

Cool!

Creating new MySQL databases from the command line.

Here is an easy way to create new databases in MySQL and also assign privileges to it. Shamelessly stolen from the Wordpress install tutorial.

$ mysql -u adminusername -p
Enter password:
Welcome to the MySQL monitor.  Commands end with?; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>; CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)

mysql>; GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname"
    ->; IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)

mysql>; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> EXIT
Bye
$

Configuring x11vnc

I just recently inherited a 24″ LCD monitor that I was going to try and use as a TV. In the end I did not end up using it because my existing setup (Xbox + Regular TV) was more convenient for me. I did however successfully set up x11vnc to control the TV computer from my laptop. Here is what I did:

  • Install x11vnc
  • Edited my /etc/conf.d/x11vnc file to look like (Yours may be in a different location):
#
# Parameters to be passed to x11vnc
#

X11VNC_ARGS="-display :0 -auth /var/run/slim.auth -scale 2/3 -loop3000 -ncache 10 -noxdamage -sleepin 10"
  • -display :0 — tells x11vnc which X screen to bind to. This is needed because x11vnc is used to connect to REAL X displays and there may be more than one.
  • -auth /var/run/slim.auth — tells x11vnc where the magic auth file is for the current login manager that is running. I am using the login manager “slim” in this case.
  • -sleepin 10 — allows X + login manager to start up fully before x11vnc tries to bind to the X display.
  • The rest of the options are quite trivial. man x11vnc will give you a much better explanation than what I could provide here.

Make sure you enable x11vnc on startup and you should be good to go!

Apple Wireless Keyboard & KBluetooth

UPDATE: November 10, 2009.
REASON: Information was completely wrong.
ORIGINAL POSTING DATE: October 27, 2009.

Well, good news on this front. I have successfully been able to pair a Apple Wireless Keyboard with my Macbook Pro using the Linux bluetooth stack and KBluetooth. The process is incredibly easy and I can’t believe I was such a big tool for so long. I literally spent DAYS of my life trying to get the keyboard to play nice with Linux. I can’t believe my utter stupidity. Here is my revised workflow:

  1. Install bluez and KBluetooth. Make sure kernel has support for bluetooth (Yours probably does).
  2. Start bluez daemon, something like /etc/init.d/bluetooth start in the terminal.
  3. Start KBluetooth inside of KDE.
  4. Open Device Manager from KBluetooth tray icon right click menu.
  5. Hit the “+New” button.
  6. Hit Next.
  7. Turn on your Apple Wireless Keyboard, it should show up in the menu immediately.
  8. Select your keyboard in the menu and hit “Next”.
  9. Hit OK when the dialog comes up saying that your keyboard has been added successfully.
  10. Now comes the easy part. Enter a PIN on your wireless keyboard followed by the enter key. I chose a PIN of 1234.
  11. A dialog should pop up on your computer requesting a PIN from you. Enter the exact same number into this dialog. Iwould enter 1234.
  12. Done! It should pair up and just work. You may want to set “Always Trusted” if you always want this keyboard to be trusted.

Just for reference I am going to keep my (rather ridiculous) old instructions.
DO NOT USE THESE!!!

Well, not good news on this front. This combination does not seem to like each other at all. I got them to work together but seriously only 15% of my attempts to connect them worked. I would do the same process over and over and over, having it succeed on random occassions where I would do nothing different than the previous connection attempt. I am not sure who is to blame here but this is flakey as hell. I am running a bleeding edge bluetooth stack and kernel and have all the correct packages installed. Once it paired and connected it has been working amazing, I don’t even need kbluetooth to start up anymore, just the bluetooth daemon from the bluez stack. I have to say that once my keyboard was paired it never stops working. It even works in single user mode with no X server running. Here is my work flow for trying to get this going:

  1. Install bluez and KBluetooth. Make sure kernel has support for bluetooth (Yours probably does).
  2. Start bluez daemon, something like /etc/init.d/bluetooth start in the terminal.
  3. Start KBluetooth.
  4. Open Device Manager from KBluetooth tray icon right click menu.
  5. Hit the “+New” button.
  6. Hit Next.
  7. Turn on your Apple Wireless Keyboard, it should show up in the menu immediately.
  8. Select your keyboard in the menu and hit “Next”.
  9. Hit OK when the dialog comes up saying that your keyboard has been added successfully.
  10. Now comes the tricky part: Hit enter on your Apple Wireless Keyboard (repeatedly if necessary) until an enter PIN dialog comes up. Enter a PIN of your choosing and hit OK.
  11. Enter the same PIN on your keyboard followed by enter.
  12. If your lucky a “Trust this device” window will come up. If not, repeat steps 10 and 11.
  13. Trust your device and it should work beautifully! You don’t even have to start up KBluetooth for your keyboard to work, just the bluetooth dameon from the bluez package should be enough.

Personal Server, Part 1: What and Why.

As a nerd, I am always looking for ways to increase my efficiency. I have come to the realization that I can only do a fixed amount of productive work per day, and that in order to increase my productivity past that fixed amount I need autonomous followers that do my bidding and help artificially increase my daily productive work. In one incarnation this is a personal desktop-like computer that I use on my home LAN network to do my bidding while I’m at work or taking out the garbage or whatever mundane life task I may be doing.

I built this server out of the remnants of my old desktop that was decommissioned due to a brand new Macbook Pro that I bought in October of 2008 (Best thing I’ve bought in a while– seriosuly I will fight you if you think otherwise).

Some things you can do with your server include:

  • Large central storage for all your media.
  • A node in a distributed compiling cluster.
  • A bit torrent seed box.
  • Web server to host all of your web sites.
  • FTP server to share your files.
  • Git/SVN/etc server to share your source code.
  • PVR.
  • WEP/WPA attacks.
  • Print server.
  • Central backup location.
  • CS/L4D/UT/etc dedicated game servers.
  • UPNP media server.
  • NFS/Samba server.
  • SQL server.
  • Transcoding.

My choice of hardware was a balance between performance and whatever I could get for the cheapest price from my local computer parts retailer (You rock memory express BTW — I highly suggest anyone in Western Canada to buy your parts here). The table below is a summary of the parts I chose to compose my new server, and the paragraph underneath is a small explanation of why I chose each part.

Hardware Description

FunctionalityChosen PartDate PurchasedPrice
CPUAMD Athlon64 X2 5200+ 2x512Kb EESeptember 7, 2008$79.95
MotherboardAsus M2A-VM 960G AM2September 7, 2008$69.95
ChipsetNorthbridge AMD 690G
Southbridge ATI SB600
September 7, 2008
MemoryOCZ 2x2GB PC26400 Platinum Kit September 7, 2008$84.95
GraphicsIntegrated Radeon X1250September 7, 2008
Storage1x 750GB Seagate SATAApril 27, 2008$157.45
OpticalBenQ 16X Dual Layer Black DVDRWJanuary 2, 2005$79.95
Power SupplyAntec EarthWatts 430WSeptember 7, 2008$64.95
CaseAntec Three Hundred Mini TowerMay 21, 2008$59.95
Fans1x 180mm
1x 120mm
1x 80mm
PrintersHP LaserJet 1018
Samsung ML-2010
January 2008$99.95
Price before tax:$697.10
A complete hardware breakdown of my server. All important components are listed.

The heart of my beast is an AMD X2 5200+ processor because it had two cores and it was selling for an unbeatable price. I went with the? two cores because I would be using this computer for? miscellaneous computationally intensive tasks like transcoding, compiling, etc. At the time there were Intel Core 2 Duos that could easily out perform this processor but 1) I like buying from the underdog and AMD has been good to me in the past and 2) AMD knew that their processors were inferior and priced them accordingly.

The motherboard purchased was a microATX form factor? ASUS M2A-VM,? which is not very note worthy in any way besides the fact that it was cheap and had 4 onboard SATA ports making it a perfect headless motherboard. It has all the usual jazz, USB ports, 4 RAM slots, Onboard sound, etc. I don’t particularly like ASUS mostly because of their broken english manuals — come on, how much would it cost to hire a fluent english speaker to proof read your manuals? Their slogan really grinds my gears and reminds me of some shitty broken engrish translation:

6a00c2251d1206549d00e398d6c8ab0005-500pi

I can see “rock solid” instilling confidence in the users of your product but “heart touching” is just quirky and awkward. Way to go ASUS marketing department.

Memory is 4GB of DDR2 ram that is clocked such that it will be in sync with the processors front side bus speed.? This isn’t necessary (front side bus and memory frequencies being whole? number multiples of each other — synced) but I like when things work out evenly. DDR2 was chosen because it was the economically efficient choice because of both 1) The lower price of DDR2 RAM and 2) Cheaper Motherboard and CPU for DDR2. 4GB of RAM is more than adequate for this machine (as it won’t be running a memory hogging desktop environment or even xorg-server for that matter, see below). To this day I have used a maximum of 1.8 gigabytes on a decked out fully configured machine (that figure is minus buffers and cache of course).

Storage is always a no brainer because I just compute which hard drive will get me the most gigabytes per dollar and the winner was a Seagate 750GB SATA drive. I have had some bad experiences with Seagate in the past but this drive was the best deal and so I ignored my historical learnings and bought it anyways. Turns out that this drive is actually quite nice, although it does run hotter than some other 7200 RPM drives I have.

I chose a plain Antec mini tower case with 6 internal hard drive bays and 3 cdrom bays. It can house a full sized atx motherboard and the six internal drive bays are perfect as the motherboard I bought has 4 serial ata connections which still left room for expansion. The position of the power supply was interesting as it was located on the bottom of the case. I wasn’t sure about this? at first but it makes sense as there is a large fan on the top of the case (180mm) that whisks the hot air that rises to the top of the case away. This is better if you contrast to the power supply being on the top of the case where the hot air stagnates and has no where to go.

I had to think long and hard about whether or not I wanted to hook this PC up to my TV and add HTPC to the list of server functions above. I finally decided that due to it’s physical size (This mini tower is still quite large) it just wasn’t suited to be hooked up to the TV. A smaller, more lightweight PC could be hooked up to the TV and the server could do all of the heavy lifting on the media. As it turns out I have XBMC (Xbox Media Center) available on an old Xbox of mine and this would serve as the perfect lightweight PC that could be hooked up to my TV. This made perfect home theater sense as the Xbox is well suited to be hooked up to a TV and the bulky media storage unit could be stored somewhere else away from eyes and ears.

This also led to another interesting option: whether or not to have a monitor hooked onto this computer. Having one really doesn’t make any sense unless it is going to be a workstation and I did not want this computer to become a workstation, mostly because I had no need of one, and ultimately went with the headless configuration. I didn’t know if I would stick with a “headless” computer but after using SSH for a while I was sold on headlessness. The dull whirrs of its fans are the only indication that the machine is even powered on.

The grand total (in Canadian funds of course) is 697.10 before tax which is not very much considering the amount of computing power you are getting for this price. Also considering what you pay at big brand computer retailers like Dell, Apple, etc this price is very competitive in comparison.