Quick links: Content - sections - sub sections

PHP configuration

  • magic_quotes_gpc and magic_quotes_runtime must be set to off. If this is not the case, you have to activate the magicquotes plugin delivered with Jelix.
  • session_auto_start must be set to off.
  • safe_mode must be set to off. (jelix not tested with on)

It is also recommended to set these values :

  • register_globals = off
  • asp_tags = off
  • short_open_tag = off

The phpinfo() function can help you to see if this options are set with the right values. You can see also the php.ini file of your server.

Server configuration

Note: each time you change the configuration of your web server (like document root, php version etc,), you must delete all files in the temp directory of your applications (like temp/myapp here), so Jelix will take care about modifications in the new configuration.

If you can change the document root

If you can specify the document root of the site by modifying the configuration files of the web server or through an administration interface provided by your web hosting, indicate the myapp/www directory as the root of the site.

For example, with apache, you will indicate in the httpd.conf file, something like:

   <VirtualHost *>
      ServerName www.mysite.com
      DocumentRoot /home/mysite/myapp/www/ 
   <Directory "/home/mysite/myapp/www/">
     AllowOverride None
     Order allow,deny
     Allow from all

You must also indicate an alias towards the lib/jelix-www directory, by naming it to "jelix" :

   <VirtualHost *>
      ServerName www.mysite.com
      DocumentRoot /home/mysite/myapp/www/ 
      Alias /jelix/ "/home/mysite/lib/jelix-www/"
   <Directory "/home/mysite/myapp/www/">
     AllowOverride None
     Order allow,deny
     Allow from all
   <Directory "/home/mysite/lib/jelix-www/">
     AllowOverride None
     Order allow,deny
     Allow from all

Note : you can choose an other name for the alias of jelix-www. If you do this, you have to change the jelixWWWPath option in the configuration file of the application.

In the file myapp/var/config/defaultconfig.ini.php, you can adjust the basePath option, by specifying the path to the index.php file (here : /).


This setting is optional since Jelix try to discover the base path. But on complex configuration (for example, you have many entry points in different sub directories), it could not work correctly, so you have to setup this option.

Thus, by typing http:www.mysite.com you reach your site, and http:www.mysite.com/jelix/, the contents of jelix-www, which contains a number of useful Javascript scripts, XUL resources etc.

If you can't change the document root

In this case, it is better to move the content of the directory myapp/www to the root of your site, mysite/. After that, you have for example :


Here in this example, index.php is the entry point of your application. You have to modify this PHP file to change the relative paths it contains (if there are other entry points, you should do it too). Same for the myapp/application.init.php file. For example, after modifications, the file index.php should look like this :

require_once ('myapp/application.init.php');

require_once (JELIX_LIB_CORE_PATH.'request/jClassicRequest.class.php');
$config_file = 'index/config.ini.php';
$jelix = new jCoordinator($config_file);
$jelix->process(new jClassicRequest());

You need also to modify the myapp/project.xml file in order to update the path of each directory, so commands of jelix-scripts will work fine (path should be relative to the project.xml path):

<project xmlns="http://jelix.org/ns/project/1.0">
    <!-- ...  -->

        <!-- ... -->

It is finally necessary to move the lib/jelix-www directory to the root and to rename it in jelix/. You will obtain:


Note: you can choose another name for the jelix-www directory. If you do this, you have to change the jelixWWWPath option in the configuration file of the application (myapp/var/config/defaultconfig.ini.php)

  • *WARNING: it highly recommanded to not store your own scripts/CSS/whatever in this directory or in jelix-www.** Else futur update will be difficult, because other colleague will be confused, and may have difficult to know what it comes from Jelix, and what it comes from your application. So don't modify the content of jelix-www or of its copies, and store your own script in an other directory, for instance, mysite/js/.

Finally, in the file myapp/application.ini.php, you must change JELIX_APP_WWW_PATH to:

define ('JELIX_APP_WWW_PATH', realpath(JELIX_APP_PATH.'../').'/');

You can then enter the address of your site (http:www.mysite.com for example, or http:localhost/)

Specify an extension other than .php

On some old servers, PHP4 and PHP5 are both proposed at the same time. In general, .php are PHP4 files and .php5 are PHP5 files. You then have to make modifications for your Jelix application to be able to use PHP5. Two ways with Apache, depending of the possibilities you have.

With .htaccess

In the www directory of your application, add .htaccess file with :

  AddHandler php5-script .php

And that's all. If this doesn't work, se the following point.

With some Hosting Provider, we can also setting an environnement variable in the .htaccess, for example:

  SetEnv PHP_VER 5

If it doesn't work, read the instructions of your provider to configure PHP5, or try the following solution.

By renaming the extension

You have to rename the index.php file in index.php5. But you don't have to rename the php files from the other directories !

In the config file var/config/defaultconfig.ini.php, put the extension in the urlengine section :

  entrypointExtension = .php5

Configuration for "cools" urls

In order to use significants URLS with the urls automatic system of jelix, you have to activate in Apache (in its configuration file or in the .htaccess):

   Options +Multiviews

With Apache 2, you have also to do this :

   AcceptPathInfo on

To verify if it is ok, create a test.php on your site, which executes phpinfo(). Then try this url : mysite.com/test/foo/bar. the phpinfo should be displayed, and in the $_SERVER[’PATH_INFO’] variable (at the bottom of the page), you should see "/foo/bar".

Directories permissions

You have to set write permission to the apache user at least on the myapp/var/log/ directory and on each sub-directories of the temp/ directory.

Example, on a debian/ubuntu server:

   sudo chown www-data:www-data temp/myapp*  myapp/var/log
   sudo chmod g+w temp/myapp* myapp/var/log

For some applications, perhaps you may have to set this permissions on other folders in myapp/var/. Read the installation manual of the application.