... Elxis version 2009.3 codename Aphrodite is out, download it from Elxis Download Center (EDC) ...

PHP settings

From Elxis Official Documentation

Revision as of 00:21, 15 January 2011 by Ks-net (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Elxis as you probably already know from your very first elxis-installation requires or recommends some settings for your php environment.
Elxis have built with security in mind, thats why risky php-settings are not necessary at all, it is a wise movement to disable, if you are not using them for other scripts. Php settings are by default reside in a configuration file at your server called php.ini.


Php.ini - Default php configuration file

If you have access to server's default php.ini file then you can set the values listed below directly in to it.
Don't forget to restart apache every time you edit default php.ini file to apply changes.

allow_url_fopen = Off

short_open_tag = Off

register_globals = Off

display_errors = Off

magic_quotes_gpc = Off

date.timezone = "Europe/Athens"

session.save_path = "/absolute/path/to/writable/folder/one_level_up_of/public_html"

disable_functions = "system, exec, passthru, shell_exec, suexec, dbmopen, popen, proc_open, disk_free_space, diskfreespace, set_time_limit, leak"


If you disable popen sending mails by using the sendmail program will not work. Use SMTP or PHP mail instead in this case.


Other Options

For users that are not having access to server's default php.ini file there are some other alternatives to configure php settings, if this is allowed from server's configuration.
The most common cases depending of how your php is installed and running on your server are:
Option A: for php running as Apache module (mod_php) , requires that you are allowed by the apache's configuration to run .htaccess files , the "AllowOverride all" option must exist!
Option B: for php running under SuPHP, again must have the right to run .htaccess files.


mod_PHP

in .htaccess in your public_html add the following:

php_flag allow_url_fopen Off *

php_flag short_open_tag Off

php_flag register_globals Off

php_flag display_errors Off

php_flag magic_quotes_gpc Off

php_value date.timezone "Europe/Athens"

php_value session.save_path "/absolute/path/to/writable/folder/one_level_up_of/public_html"

php_value disable_functions "system, exec, passthru, shell_exec, suexec, dbmopen, popen, proc_open, disk_free_space, diskfreespace, set_time_limit, leak" *

* these settings can only be changed through default php.ini file, if there are not configured as needed and you haven't access to php.ini contact to your hosting provider to set them for you!

SuPHP

In .htaccess under public_html, add the following line:

suPHP_ConfigPath /absolute/path/to/public_html


In php.ini under public_html add the following, or any other settings that you want to use:

allow_url_fopen = Off

short_open_tag = Off

register_globals = Off

display_errors = Off

magic_quotes_gpc = Off

date.timezone = "Europe/Athens"

session.save_path = "/absolute/path/to/folder/one_level_up_of/public_html"

disable_functions = "system, exec, passthru, shell_exec, suexec, dbmopen, popen, proc_open, disk_free_space, diskfreespace, set_time_limit, leak"


For the PHP settings you do not have in your php.ini file, PHP will use default configurations. It will not use the server php.ini but rather a default one.You may need to set other settings.


test php settings

To check if your custom settings are present create a phpinfo.php file in public_html with the following code inside it:

<?php phpinfo();?>

Then call it in your browser to see loaded php settings.



Read Also

date.timezone detailed documentation for "date.timezone" directive in elxis 2009.1+ and php5.2+ installations

External references

PHP official site
PHP runtime configuration (php.ini etc..)
php.ini directives
Apache .htaccess file
Suphp official site

Personal tools