====== Setting up your server ====== There are different settings you may set up within your server to improve the performance, the maximum filesize upload limit, how to send the email notifications, etc. ===== PHP Settings ===== There are some PHP configuration options available in the php.ini file which are relevant for Feng Office. To access this file you need at least FTP access to the server Feng Office is running on (which is typically reserved to the webmaster). PLEASE NOTE: There may be several php.ini files in different directories on a webserver which may interfere which each other. If changing the parameter values in your php.ini has no effect then it's very likely that there is another php.ini on your server. Maybe your hosting provider offers a control panel where you can define these values globally. ===== Changing the Maximum Filesize upload limit ===== There are two files you may have to change for this, other than the Apache server settings by allowing overrides. In the example below, it will limit the maximum filesize to 100 MB. Use another value if you want to of course. Access (or create if it does not exist) the file named **FENG_ROOT/.htaccess** and add the following lines: php_value post_max_size 100M php_value upload_max_filesize 100M Then, access (or create) the **FENG_ROOT/php.ini** file and add the following lines: post_max_size = 100M upload_max_filesize = 100M ===== Email Notifications ===== Email notifications within Feng Office can be sent through two different ways: - SMTP Account - PHP Method [[notifications:notifications|Here]] you will find more information on how to configure e-mail notifications. ===== Setting up an SSL connection ===== SSL connections will provide you with a more secure connection, encrypting information so that you can avoid other people sniffing into your sent/received packets. If you are using a Feng Sky installation, please contact your Account Executive or the Support Team to request SSL activation. On the other hand, if you are using Feng Office within your server, you must do as following: - Install the SSL certificate in your server - Then go to **FENG_ROOT/config/config.php** file and edit the ROOT URL and add https there so that it looks like: define('ROOT_URL', 'https://myfengoffice.somewhere.com'); - Lastly, you have to edit your **.htaccess** file and add the following lines: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ===== Tuning up your MySQL Server ===== By default the MySQL Server has some low settings for the memory usage. Therefore.. if you tune it up, your Feng Office installation performance can be grealy enhanced. - Access your MySQL configuration file (i.e.: in Debian: **/etc/mysql/my.cnf**) - Edit its values to higher ones. We suggest the following ones, which are in yellow background:{{:mysql_tuning.png?400}} - Restart your MySQL Server (i.e.: in Debian: **/etc/init.d/mysql restart**) ===== Increasing Memory Usage ===== Sometimes, when you have lots of data, your Feng Office may misbehave due to not having enough memory. This usually leads to an **Error 500**, which can always be traced within the Apache Error Log. Please make sure whether you find a message saying something similar to the following one: **PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2751248 bytes)** Should you find any, you ought to do as following: *Edit the **.htaccess** file and increase the PHP memory adding this line: php_value memory_limit 512M Note: You may add a different value. *Edit the **php.ini** file increasing the timeout limit adding this line: max_execution_time = 300 Note: You may add a different value. ===== Performance boost: saving permissions in background ===== Granular permissions are great! They let you manage users access at will. However, in case you have hundreds of users and you manage thousands of projects, clients or departments, you might notice some performance issues if your hardware is not strong enough. For this very reason we created a method to save permissions in background, so that after you edit a user or a project permissions, you can keep on working while the new changes are saved (in background). However, in order to enjoy this performance improvement, you need to have the "exec" in your php.ini available, but in many servers, specially in non dedicated ones, this function is not available. Therefore, we applied changes for the 3.0 version onwards for whoever installs Feng Office outside our cloud: by default permissions will not be saved in background as this used to cause certain confusions and misunderstandings due to the server settings. That being said, if you would like to **enable this option, which we recommend,** you need to set up your server accordingly: There is a directive called "disabled_functions" which can block some PHP functions, like **the "exec", which you need**. So, you need to make sure that "exec" is NOT defined here, otherwise it will be blocked and the permissions will not run in background. On the other hand, there is a module called Suhosin, which is useful for security purposes among others, which has a similar function called "suhosin.executor.func.blacklist". In case you have this module installed, make sure that "exec" is NOT defined here either. **After you made sure of the "exec" function being enabled**, you need to set the following line in the config.php file and that is it: define('SAVE_PERMISSIONS_IN_BACKGROUND', true); Last but not least, in case you have the following constant defined from versions prior to the 3.0, do get rid of it by deleting the whole line or otherwise the previous constant will be overridden permissions will not be saved in background: define('DONT_SAVE_PERMISSIONS_IN_BACKGROUND', true); ===== PHP magic quotes ===== Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. Magic quotes can generate some json errors. Access the file named **FENG_ROOT/php.ini** and add the following line: magic_quotes_gpc=Off ===== Other recommended variables for Apache configuration ===== Modifications on the **.htaccess** file: AddDefaultCharset utf-8 This is the recommended encoding. php_value max_execution_time 120 Maximum time for running a process. This is the recommended value.