NaSMail About  |  Documentation  |  Downloads  |  Plugins  |  Contribs  |  Project Site

NaSMail PHP requirements

NaSMail should work with any PHP version newer than 4.1.0, if it satisfies requirements listed below and does not have bugs that break NaSMail scripts.

Required extensions

Session and pcre

Standard extensions enabled by default. NaSMail scripts won't work, if these extensions are missing or PHP session setup is broken.


NaSMail scripts will work, if extension is missing, but some internationalization features might be broken.

Optional extensions


Extension is used for translations. If it is not available, code uses bundled PHP Gettext classes.


Extension is used to secure connections between webserver and imap/smtp/pop servers. It is required, if NaSMail is configured to use TLS or STARTTLS connections. TLS configuration options require PHP 4.3.0 or later. If you use PHP 4.x, OpenSSL support must be compiled staticly. See PHP bug #29934. STARTTLS options require PHP 5.1.0 or later.


Extension is used in cram-md5 and digest-md5 authentication schemas. There are internal alternatives


XML extension was required for digest-md5 authentication schema in NaSMail 1.0-1.1. It is not required in NaSMail 1.2 and later versions.


Extension can be used in spellcheck plugin. Plugin works fine without it


PHP LDAP extension functions are used in LDAP address books. If functions are not available, NaSMail core scripts don't show LDAP address book options to end user. Some LDAP address book configuration options require extension linked to OpenLDAP client libraries. Some require OpenLDAP client libraries with SSL/TLS support.


Extension functions can be used in spellcheck plugin. Plugin can be configured to use program execution functions or pspell extension. Program execution functions are used by default.

Pear and database extensions

Pear DB libraries are used, if preferences or address books are stored in database

Recode and iconv

These extensions are optional. They can be used in decoding functions with Chinese, Japanese and Korean (CJK) character sets. If extensions are not available, stock decoding functions will leave CJK characters undecoded. If you need CJK decoding functions, use of recode extension is recommended. iconv decoding is unstable. mbstring decoding provides only limited options and depends on used PHP version.


Some parts of interface can use posix extension functions in order to provide verbose error messages. Administrator plugin can use posix functions for one of authentication methods. Extension is not required. If it is not available, error messages will be less verbose and administrator plugin can use other authentication method.

Other extensions

Other extensions depend on used third party plugins.

PHP cache

PHP cache extensions (APC, Zend Optimizer, XCache) improve NaSMail performance. These extensions can lower peak memory usage (only APC and Zend Platform) and speedup script execution.

PHP configuration options


register_globals=on is dangerous. NaSMail scripts impose very strict coding rules in such setups. If scripts are not coded correctly, they will break. It is strongly recommended to run NaSMail in register_globals=off setup.

Safe mode

NaSMail should work when safe mode is turned on with some quirks.


Setting might block script access to preference or attachment directories. If your scripts are restricted with PHP open_basedir, make sure that all NaSMail scripts, data and attachment directories and PHP upload_tmp_dir are not blocked.

File uploads

NaSMail uses PHP file uploads for attachment handling. If 'file_uploads' is turned off, end users will be unable to add attachments to composed emails. 'post_max_size', 'memory_limit' and 'upload_max_filesize' settings limit attachment size.

Non default mbstring.func_override value

Don't enable mbstring.func_override. It makes string functions unreliable. Standard PHP string functions are not aware about multibyte character sets and NaSMail scripts are written to work with such functions. Some NaSMail functions work with binary 8bit strings and these strings don't follow multibyte character set formating rules. If string functions start recognizing string length in symbols and not in bytes, scripts might break. NaSMail scripts have workarounds to fix possible mbstring function overriding issues, but it is strongly recommended to turn on this setting only for scripts that ask for it and not in php.ini.


PHP6 introduced Unicode support in core functions, Unicode extension and unicode.semantics setting. NaSMail scripts are designed to work with string functions that are not aware about charset differences and multibyte characters. If Unicode semantics are turned on, they change behavior of core PHP functions. Changes are not backwards compatible with older PHP versions and NaSMail can't manipulate strings same way as in older PHP versions. Coding NaSMail with unicode.semantics=on compatibility will require major rewrite in all scripts and will break backwards compatibility.

unicode.semantics setting can be set only in webserver configuration or php.ini and scripts can't turn it off. There are no plans to make NaSMail work in unicode.semantics=on setups in near future. Please turn off this setting, if you want to use NaSMail in PHP6.

<directory /var/www/nasmail>
    php_admin_flag unicode.semantics off

Magic quotes

NaSMail can run correctly in magic_quotes_gpc = on and magic_quotes_gpc = off environments. Scripts automatically remove magic_quotes_gpc=on effects.

'magic_quotes_runtime' setting is forced to off

Running in magic_quotes_sybase=on setup is not recommended. Some scripts might ignore possible addslashes/stripslashes behavior changes.


NaSMail scripts change 'session.use_cookies', 'session.use_trans_sid', 'url_rewriter.tags' settings in order to make sure that interface works according to selected NaSMail configuration. It is strongly recommended not to restrict those settings with php_admin_* options in webserver configuration. If cookieless mode is used in PHP 4.3.0 or later PHP 4.x version, 'session.use_trans_sid' must be turned on in .htaccess, webserver configuration or php.ini.

NaSMail scripts change '' to name defined in interface configuration.

'session.gc_maxlifetime' sets session expiration time. NaSMail scripts periodically reload left_main.php frame in order to keep active session. Frame is reloaded once in 10 minutes by default.

Program execution functions

NaSMail uses program execution functions (proc_open, popen, exec, shell_exec, pclose, escapeshellcmd) to submit emails to Sendmail binary, if Sendmail delivery system is used, to run spell checking utilities in spellcheck plugin, to run dns rbl checks with bulkquery utility in filters plugin and to retrieve fortune cookies in fortune plugin.

If program execution functions are disabled, they will block only use of fortune plugin. Interface can use SMTP deliveries instead of Sendmail. Spellcheck can use PHP Pspell extension. Filters plugin can run RBL checks with standard PHP network functions and use of bulkquery is not enabled by default.


Some scripts can change 'max_execution_time' setting, if they expect that operation might take longer than 30 seconds. Scripts can change this setting only in safe_mode=off setups.

error_reporting, display_errors and track_errors

Main NaSMail scripts don't change error_reporting and display_errors settings. Scripts are designed to work without error notices in error_reporting=E_ALL setups (E_ALL & ~E_STRICT in PHP6). If you get errors in such setups, report them on NaSMail bug tracker.

Decoding library uses 'track_errors' to detect iconv extension errors.

variables_order and gpc_order

NaSMail scripts need access to GET, POST, SERVER and COOKIE variables. Make sure that these PHP settings don't block access to required variables.


NaSMail scripts are loaded with paths relative to NaSMail top directory. Only database abstraction libraries (Pear DB) are loaded from include_path. Scripts don't depend on include path, if database options are not used in NaSMail configuration and third party plugins.


Bug report plugin uses browscap options to get more information about user's browser. If browscap.ini is not available, plugin reads only user agent string.

auto_prepend_file and auto_append_file

If you load some custom scripts in these PHP options, make sure that they don't output anything (including bare linefeeds). If 'auto_prepend_file' outputs something, it should stop further script execution on output. If 'auto_append_file' outputs something, it will corrupt file downloads and will break html formating.

Other recommendations

Don't use --enable-sigchild

PHP --enable-sigchild compilation option breaks program execution status codes. It is needed only for some old Oracle libraries and newer Oracle libraries should work fine without it.

Plugins that depend on correct execution status codes

Security extensions and libraries

Apache and php security extensions (mod_security, suhosin or others) should not break things, if you don't enable security features on src/compose.php and personal information pages. If security features are enabled on scripts with compose or signature forms, they might block use of NaSMail scripts with false alarms.

System security libraries (SELinux) might break network operations in NaSMail scripts.

PHP cache/debuggers

If you use some PHP cache, optimizer or other kind of Zend extension and have issues with NaSMail scripts, make sure that you have same issues when extension is disabled.

Known PHP version issues


This version has known issues with some file uploads. Version bundled with Debian Sarge is fixed.


Broken array functions and mbstring extension. Use of this PHP version with NaSMail scripts is not supported.

Which PHP version is better?

NaSMail scripts are written in low level PHP functions and should work in any PHP version, if it has required extensions and satisfies minimal version requirements. If selected PHP version does not provide needed functions, scripts use alternative functions, disable feature or display notice about unsupported configuration.

NaSMail scripts have some code specific to PHP 4.1.x, 4.2.x, 4.3-4.x, 5.0+, 5.1+ and 6.0-dev versions. Use of PHP 5.1.0 or newer officially released version is recommended. Older PHP versions can have timezone issues on Windows platform and don't support some advanced IMAP/POP/SMTP connection options.

This file last modified on 2013-07-23 21:23 CEST
Copyright © 2006-2009 The NaSMail Project