Quick links: Content - sections - sub sections
EN FR

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/ 
   </VirtualHost>
   <Directory "/home/mysite/myapp/www/">
     AllowOverride None
     Order allow,deny
     Allow from all
   </Directory>

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/"
   </VirtualHost>
   <Directory "/home/mysite/myapp/www/">
     AllowOverride None
     Order allow,deny
     Allow from all
   </Directory>
   <Directory "/home/mysite/lib/jelix-www/">
     AllowOverride None
     Order allow,deny
     Allow from all
   </Directory>

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/mainconfig.ini.php, you can adjust the basePath option, by specifying the path to the index.php file (here : /).


basePath="/"

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 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 :

  mysite/  
    myapp/
    lib/
    temp/
    index.php

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">
    <!-- ...  -->
    <directories>
        <config>./var/config/</config>
        <log>./var/log/</log>

        <var>./var/</var>
        <www>../</www>
        <temp>../temp/myapp/</temp>
    </directories>
    <entrypoints>
        <!-- ... -->
    </entrypoints>
</project>

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

  mysite/  
    myapp/
    jelix/
    lib/
    temp/
    index.php

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/mainconfig.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 the path (second parameter to jApp::initPaths):


jApp::initPaths(
    $appPath
    $appPath.'../',
    //$appPath.'var/',
    //$appPath.'var/log/',
    //$appPath.'var/config/',
    //$appPath.'scripts/'
);

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

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.