Chapter: Install on a production server
|« Install an application||^ Installation|
− Table of content
We call production server, the server on which you will install your finished application, therefore accessible to the end-users. By opposition, there is the server of development, that on which you develop your application.
There are certain different things to take account in the case of the production server, in order to optimize the execution of your application based on Jelix.
Choosing the good edition of Jelix ¶
To develop, you use of course the "developer" edition of Jelix. This edition includes tools and scripts for the command line and other things for the development.
However, for the installation on a production server, it is preferable to install the "optimized" edition of Jelix. As its name indicates it, it is optimized, and the useless things in production are removed. Note however that your application will function exactly the same way that with one of the other editions of Jelix, with details meadows: one will be able to observe light improvements of performance with the "Optimized" edition ;-).
If you choose to remain with the "developer" edition on your production server, there is no problem with that. However it is recommended to remove scripts for command line.
Note: an experimental "Gold" edition is available, for the developers which can modify the configuration of php, in particular, to install extensions PHP. Indeed, this edition uses some extensions PHP which are not available among all hosts, and this edition uses also an extension PHP especially dedicated to Jelix, which deals with certain treatments of the framework. The use of "gold" edition thus appreciably improves the performances of your application.
The installation occurs to identical that on the server from development, including for the application.
To have better performance and more safety, here however some additional advices.
About the server configuration ¶
- Directories other than the www of your application should be apart from the “document root” Web site.
- To specify the rights well on the temp/ directory. For example, the user which runs Apache should have write rights an this directory. It is not recommended on linux, to chmod 0777 on the temp directory ;-)
About the application ¶
Here some advices for the configuration of the application, in the var/config/defaultconfig.ini.php file.
error_handling section ¶
In the section error_handling, the following configuration is highly advised:
[error_handling] messageLogFormat = "%date%\t[%code%]\t%msg%\t%file%\t%line%\n" logFile = error.log email = root@localhost emailHeaders = "From: email@example.com\nX-Mailer: Jelix\nX-Priority: 1 (Highest)\n" quietMessage="A technical error has occured. Sorry for this trouble." ; keywords you can use : ECHO, ECHOQUIET, EXIT, LOGFILE, SYSLOG, MAIL, TRACE default = ECHOQUIET EXIT LOGFILE error = ECHOQUIET EXIT LOGFILE warning = ECHOQUIET LOGFILE notice = strict = ; for the exceptions, there is implicitly EXIT exception = ECHOQUIET LOGFILE
It is disadvised using the keyword ECHO, which posts all the details of the errors in the Web pages (information which could be useful for pirates), but rather ECHOQUIET, which posts simply the message indicated in the parameter quietMessage.
However, it is useful to be informed of the errors and their details. Also, parallel to ECHOQUIET, it is recommended to add one of these key words
- LOGFILE: the errors are inserted in the file indicated in logFile
- SYSLOG: the errors are recorded on the level of the system
- EMAIL: the errors are sent by Mail.
Be carefull with the use of EMAIL: use it only once you know that your application functions well on the production server. Else you may be flooded with emails (and your hosting provider may not be very happy with that, and could think you are a spammer :-) )
Be carefull also with the use of SYSLOG: put this option only if it is your own server (i.e. you are an administrator of the machine). Else the owner of the machine is likely not to appreciate.
In conclusion: LOGFILE is rather advised compared to EMAIL and with SYSLOG ;-)
compilation section ¶
In the section "compilation", you can deactivate the option "checkCacheFiletime", and even more recommended, the option "forces", if you activated it for the development.
[compilation] checkCacheFiletime = off force = off
The option checkCacheFiletime avoids Jelix to check all the time that the cache (files generated by Jelix for the files of configurations, the CAD, templates etc) is quite up to date compared to the files of the application. This checking is generally useless in production, since the application is seldom modified. Of course, if you deactivate it, you should imperatively empty the directory of cache (temp/votre_appli/) at each update of your application, so that your modifications are well taken into account! (especially when it is about modification in the configuration, of the daos, local, templates.)
mailer section ¶
Do not forget to update the parameters of the section "mailer". Indeed, the parameters to send emails are not always identical between the server of development and the server of production.