- Configuring a virtualhost in a domain, not in a sub folder inside a domain.
- Configuring a virtualhost in a domain, not in a sub folder inside a domain.
- A working LAMP/WAMP server with PHP 8.1+
- A working LAMP/WAMP server with PHP 8.2+
### Software stack install (Ubuntu)
### Software stack install (Ubuntu)
You will need PHP8+ and NodeJS v18+ to run Chamilo 2.
You will need PHP8.2+ and NodeJS v18+ to run Chamilo 2.
On a fresh Ubuntu 22.04, you can prepare your server by issuing an apt command like the following with sudo (or as root, but not recommended for security reasons):
On Ubuntu 24.04+, the following should take care of most dependencies.
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt update && apt -y install nodejs
~~~~
~~~~
* Other option to install nodejs is by using NVM (Node Version Manager). You can install it following the instructions [here](https://github.com/nvm-sh/nvm#installing-and-updating).
Then, you can install the node version required. Preferably, the LTS version.
Another option to install nodejs is by using NVM (Node Version Manager). You can install it following the instructions [here](https://github.com/nvm-sh/nvm#installing-and-updating).
You can install the desired node version (preferably, the LTS version):
~~~~
~~~~
sudo nvm install --lts
sudo nvm install --lts
sudo nvm use --lts
sudo nvm use --lts
~~~~
~~~~
With NodeJS installed, you must enable corepack and then continue with the requirements
With NodeJS installed, you must enable corepack and then continue with the requirements
~~~~
~~~~
sudo corepack enable
sudo corepack enable
cd ~
cd ~
# follow the instructions at https://getcomposer.org/download/
~~~~
Follow the instructions at https://getcomposer.org/download/ to get Composer, then:
~~~~
sudo mv composer.phar /usr/local/bin/composer
sudo mv composer.phar /usr/local/bin/composer
# optionally, you might want this:
~~~~
#### Apache tweaks
Optionally, you might want this to enable a series of Apache modules, but only ``rewrite` is 100% necessary:
~~~~
sudo apt install libapache2-mod-xsendfile
sudo apt install libapache2-mod-xsendfile
sudo a2enmod rewrite ssl headers expires
sudo a2enmod rewrite ssl headers expires
sudo systemctl restart apache2
sudo systemctl restart apache2
~~~~
~~~~
When your system is all set, you can use the following:
When your system is all set, you can use the following:
In your web server configuration, ensure you allow for the interpretation of .htaccess (`AllowOverride all` and `Require all granted`), and point the `DocumentRoot` to the `public/` subdirectory.
In your web server configuration, ensure you allow for the interpretation of .htaccess (`AllowOverride all` and `Require all granted`), and point the `DocumentRoot` to the `public/` subdirectory.
Finally, make sure your PHP config points at Redis for sessions management.
This should look similar to this very short excerpt (in your Apache vhost block):
Don't forget to reload your Apache configuration after each change:
~~~~
sudo systemctl reload apache2
~~~~
### Web installer
### Web installer
Once the above is ready, enter the **main/install/index.php** and follow the UI instructions (database, admin user settings, etc).
Once the above is ready, use your browser to load the URL you have defined for your host, e.g. https://my.chamilo.net (this should redirect you to `main/install/index.php`) and follow the UI instructions (database, admin user settings, etc).
After the web install process, change the permissions back to a reasonably safe state:
After the web install process, change the permissions back to a reasonably safe state:
~~~~
~~~~
chown -R root .env config/
chown -R root .env config/
~~~~
~~~~
## Quick update
## Quick update for development/testing purposes
If you have already installed it and just want to update it from Git, do:
If you have already installed it and just want to update it from Git, do:
This will respect the migration logic and do the required data processing.
This will respect the migration logic and do the required data processing.
This will update the JS (yarn) and PHP (composer) dependencies in the public/build folder.
The commands above will update the JS (yarn) in public/build/ and PHP (composer) dependencies in vendor/.
Sometimes there are conflicts with existing files so to avoid those here are some hints :
Sometimes there are conflicts with existing files so, to avoid those, here are some hints :
- for composer errors you can remove the vendor folder and composer.lock file
- for composer errors, you can remove the vendor folder and composer.lock file
- for yarn erros you can remove yarn.lock .yarn/cache/* node_modules/*
- for yarn errors, you can remove yarn.lock .yarn/cache/* node_modules/*
- when opening Chamilo, it does not load, then you can delete var/cache/*
- when opening Chamilo, if the page does not load, then you might want to delete var/cache/*
### Refresh configuration settings
### Refresh configuration settings
In case you believe some settings in Chamilo might not have been processed correctly based on an incomplete migration
In case you believe some settings in Chamilo might not have been processed
or a migration that was added after you installed your development version of Chamilo, the URL /admin/settings_sync is
correctly based on an incomplete migration or a migration that was added
built to try and fix that automatically by updating PHP classes based on the database state.
after you installed your development version of Chamilo, the
This issue rarely happens, though.
/admin/settings_sync URL is built to try and fix that automatically by updating
PHP classes based on the database state. This issue rarely happens, though.
## Quick re-install
## Quick re-install
If you have it installed in a dev environment and feel like you should clean it up completely (might be necessary after changes to the database), you can do so by:
If you have it installed in a dev environment and feel like you should clean it
up completely (might be necessary after changes to the database), you can do so
by:
* Removing the `.env` file
* Removing the `.env` file
* Load the {url}/main/install/index.php script again
* Loading the {url}/main/install/index.php page again
The database should be automatically destroyed, table by table. In some extreme cases (a previous version created a table that is not necessary anymore and creates issues), you might want to clean it completely by just dropping it, but this shouldn't be necessary most of the time.
The database should be automatically destroyed, table by table. In some extreme
cases (a previous version created a table that is not necessary anymore and
creates issues), you might want to clean it completely by just dropping the
database, but this shouldn't be necessary most of the time.
If, for some reason, you have issues with either composer or yarn, a good first step is to delete completely the `vendor/` folder (for composer) or the `node_modules/` folder (for yarn).
If, for some reason, you have issues with either composer or yarn, a good first
step is to delete completely the `vendor/` folder (for composer) or the
`node_modules/` folder (for yarn).
## Development setup (Dev environment, stable environment not yet available)
## Development setup (Dev environment, stable environment not yet available)
If you are a developer and want to contribute to Chamilo in the current development branch (not stable yet),
If you are a developer and want to contribute to Chamilo in the current
then please follow the instructions below. Please bear in mind that the development version is NOT COMPLETE at this time,
development branch (not stable yet), then please follow the instructions below.
and many features are just not working yet. This is because we are working on root components that require massive changes to the structure of the code, files and database. As such, to get a working version, you might need to completely uninstall and re-install from time to time. You've been warned.
Please bear in mind that the development version is NOT STABLE at this time,
and many features are just not working yet. This is because we are working on
root components that require massive changes to the structure of the code,
files and database. As such, to get a working version, you might need to
completely uninstall and re-install from time to time. You've been warned.
First, apply the procedure described here: [Managing CSS and JavaScript in Chamilo](assets/README.md) (in particular, make sure you follow the given links to install all the necessary components on your computer).
First, apply the procedure described here:
[Managing CSS and JavaScript in Chamilo](assets/README.md) (in particular,
make sure you follow the given links to install all the necessary components
on your computer).
Then make sure your database supports large prefixes (see [this Stack Overflow thread](https://stackoverflow.com/questions/43379717/how-to-enable-large-index-in-mariadb-10/43403017#43403017) if you use MySQL <5.7orMariaDB<10.2.2).
Then make sure your database supports large prefixes
(see [this Stack Overflow thread](https://stackoverflow.com/questions/43379717/how-to-enable-large-index-in-mariadb-10/43403017#43403017)
if you use MySQL <5.7orMariaDB<10.2.2).
Load the (your-domain)/main/install/index.php URL to start the installer (which is very similar to the installer in previous versions).
Load the (your-domain)/main/install/index.php URL to start the installer (which
If the installer is pure-HTML and doesn't appear with a clean layout, that's because you didn't follow these instructions carefully.
is very similar to the installer in previous versions).
If the installer is pure-HTML and doesn't appear with a clean layout, that's
probably because you didn't follow these instructions carefully.
Go back to the beginning of this section and try again.
Go back to the beginning of this section and try again.
If you want hot reloading for assets use the command `yarn run encore dev-server`. This will refresh automatically
If you want hot reloading for assets use the command `yarn run encore dev-server`.
your assets when you modify them under `assets/vue`. Access your chamilo instance as usual. In the background, this will serve
This will refresh automatically your assets when you modify them under
assets from a custom server on http://localhost:8080. Do not access this url directly since
`assets/vue`. Access your chamilo instance as usual. In the background, this
[Encore](https://symfony.com/doc/current/frontend.html#webpack-encore) is in charge of changing url assets as needed.
will serve assets from a custom server on http://localhost:8080. Do not access
this url directly since [Encore](https://symfony.com/doc/current/frontend.html#webpack-encore)
is in charge of changing url assets as needed.
### Supporting PHP 7.4 and 8.1 in parallel
### Supporting PHP 7.4 and 8.3 in parallel
You might want to support PHP 8.1 (for Chamilo 2) and PHP 7.4 (for all other things) on the same server simultaneously. On Ubuntu, you could do it this way:
You might want to support PHP 8.3 (for Chamilo 2) and PHP 7.4 (for all other
things) on the same server simultaneously. On Ubuntu, you could do it this way:
sudo vim /etc/apache2/sites-available/[your-chamilo2-vhost].conf
sudo vim /etc/apache2/sites-available/[your-chamilo2-vhost].conf
```
```
In the vhost configuration, make sure you set PHP 8.1 FPM to answer this single vhost by adding, somewhere between your `<VirtualHost>` tags, the following:
In the vhost configuration, make sure you set PHP 8.3 FPM to answer this single
vhost by adding, somewhere between your `<VirtualHost>` tags, the following:
```
```
<IfModule!mod_php8.c>
<IfModule!mod_php8.c>
<IfModuleproxy_fcgi_module>
<IfModuleproxy_fcgi_module>
@ -195,7 +269,7 @@ In the vhost configuration, make sure you set PHP 8.1 FPM to answer this single
@ -212,19 +286,29 @@ Then exit and restart Apache:
sudo systemctl restart apache2
sudo systemctl restart apache2
```
```
Finally, remember that PHP settings will have to be changed in /etc/php/8.1/fpm/php.ini and you will have to reload php8.1-fpm to take those config changes into account.
Finally, remember that PHP settings will have to be changed in
`/etc/php/8.3/fpm/php.ini` and you will have to reload `php8.3-fpm` to take
those config changes into account.
```
```
sudo systemctl reload php8.1-fpm
sudo systemctl reload php8.3-fpm
```
```
When using 2 versions, you will also have issues when calling `composer update`, as this one needs to be called by the relevant PHP version.
When using 2 versions, you will also have issues when calling
`composer update`, as this one needs to be called by the relevant PHP version.
This can be done like so:
This can be done like so:
```
```
/usr/bin/php8.1 /usr/local/bin/composer update
/usr/bin/php8.3 /usr/local/bin/composer update
or, for Chamilo 1.11
or, for Chamilo 1.11
/usr/bin/php7.4 /usr/local/bin/composer update
/usr/bin/php7.4 /usr/local/bin/composer update
```
```
If your default php-cli uses PHP7.4 (see `ln -s /etc/alternatives/php`), you might have issues running with a so-called `platform_check.php` script when running `composer update` anyway. This is because this script doesn't user the proper launch context, and you might need to change your default settings on Ubuntu (i.e. change the link /etc/alternatives/php to point to the other php version) before launching `composer update`. You can always revert that operation later on if you need to go back to work on Chamilo 1.11 and Composer complains again.
If your default php-cli uses PHP7.4 (see `ln -s /etc/alternatives/php`),
you might have issues running with a so-called `platform_check.php` script
when running `composer update` anyway. This is because this script doesn't
user the proper launch context, and you might need to change your default
settings on Ubuntu (i.e. change the link /etc/alternatives/php to point to
the other php version) before launching `composer update`. You can always
revert that operation later on if you need to go back to work on Chamilo 1.11
and Composer complains again.
### git hooks
### git hooks
@ -236,26 +320,31 @@ following commands can be used.
## Changes from 1.x
## Changes from 1.x
* in general, the main/ folder has been moved to public/main/
* in general, the main/ folder has been moved to public/main/
* a big part of the frontend has been migrated to VueJS + Tailwind CSS
* app/Resources/public/assets moved to public/assets
* app/Resources/public/assets moved to public/assets
* main/inc/lib/javascript moved to public/js
* main/inc/lib/javascript moved to public/js
* main/img/ moved to public/img
* main/img/ moved to public/img
* main/template/default moved to src/CoreBundle/Resources/views
* main/template/default moved to src/CoreBundle/Resources/views
* src/Chamilo/XXXBundle moved to src/CoreBundle or src/CourseBundle
* src/Chamilo/XXXBundle moved to src/CoreBundle or src/CourseBundle
* bin/doctrine.php removed use bin/console doctrine:xyz options
* bin/doctrine.php removed use bin/console doctrine:xyz options
* Plugin images, css and js libs are loaded inside the public/plugins folder
* Plugin images, CSS and JS libs are loaded inside the public/plugins folder
(composer update copies the content inside plugin_name/public inside web/plugins/plugin_name
(composer update copies the content inside plugin_name/public inside web/plugins/plugin_name
* Plugins templates use asset() function instead of using "_p.web_plugin"
* Plugins templates use the ``asset()` function instead of using "_p.web_plugin"
* Remove main/inc/local.inc.php
* `main/inc/local.inc.php` has been removed
* Translations managed through Gettext
* Translations are managed through Gettext
Libraries
Libraries
* Integration with Symfony 5
* Integration with Symfony 6
* PHPMailer replaced with Symfony Mailer
* PHPMailer replaced with Symfony Mailer
* bower replaced by [yarn](https://yarnpkg.com)
* Bower replaced by [yarn](https://yarnpkg.com)
## JWT Authentication
## JWT Authentication
This version of Chamilo allows you to use a JWT (token) to use the Chamilo API
more securely. In order to use it, you will have to generate a JWT token as
follows.
* Run
* Run
```shell
```shell
php bin/console lexik:jwt:generate-keypair
php bin/console lexik:jwt:generate-keypair
@ -290,8 +379,8 @@ If you want to submit new features or patches to Chamilo 2, please follow the