Laravel & Symfony
This tutorial puts a Laravel or Symfony project online on a Tauri hosting account. You prepare the project on your own computer with Composer, send it as a single zip file over FTPS, then unpack it and run the framework's console over SSH. The site is then served over HTTPS on the account's domain, with its data in Tauri's built-in SQL database. Ce tutoriel met en ligne un projet Laravel ou Symfony sur un compte d'hébergement Tauri. Vous préparez le projet sur votre propre ordinateur avec Composer, l'envoyez en un seul fichier zip par FTPS, puis le décompressez et lancez la console du framework par SSH. Le site est alors servi en HTTPS sur le domaine du compte, ses données dans la base SQL intégrée de Tauri.
1. Before you startAvant de commencer
| WhatQuoi | DetailDétail |
|---|---|
| A hosting account with its domainUn compte d'hébergement et son domaine | Created by the operator (Hosting). One account serves one domain: for a Laravel site and a Symfony site on two domains, ask for two accounts. To add an application beside a site the account already serves, see section 7.Créé par l'opérateur (Hébergement). Un compte sert un domaine : pour un site Laravel et un site Symfony sur deux domaines, demandez deux comptes. Pour ajouter une application à côté d'un site que le compte sert déjà, voyez la section 7. |
| Enough disk quotaAssez de quota disque | The default 50 MB is too small. A fresh Laravel 13 project takes about 75 MB (9,000 files), a Symfony 7.4 project with Doctrine about 25 MB; the zip you upload counts too until you delete it. Ask for at least 150 MB (operator: useradm quota <compte> 150000).Les 50 Mo par défaut ne suffisent pas. Un projet Laravel 13 neuf occupe environ 75 Mo (9 000 fichiers), un projet Symfony 7.4 avec Doctrine environ 25 Mo ; le zip envoyé compte aussi tant que vous ne l'avez pas effacé. Demandez au moins 150 Mo (opérateur : useradm quota <compte> 150000). |
| The right versionsLes bonnes versions | Tauri runs PHP 8.3. Laravel 12 and 13 work. For Symfony, take 7.4 (LTS): Symfony 8 requires PHP 8.4.Tauri exécute PHP 8.3. Laravel 12 et 13 conviennent. Pour Symfony, prenez la 7.4 (LTS) : Symfony 8 exige PHP 8.4. |
| On your computerSur votre ordinateur | PHP, Composer, a zip tool, an FTPS client (FileZilla) and an SSH client (OpenSSH or PuTTY). Composer does not run on Tauri: the vendor/ folder is built on your side and uploaded with the rest.PHP, Composer, un outil zip, un client FTPS (FileZilla) et un client SSH (OpenSSH ou PuTTY). Composer ne tourne pas sur Tauri : le dossier vendor/ est construit chez vous et envoyé avec le reste. |
If your computer has a newer PHP than 8.3, tell Composer to resolve the dependencies for the server's PHP, in composer.json, then run composer update:
Si votre ordinateur a un PHP plus récent que 8.3, demandez à Composer de résoudre les dépendances pour le PHP du serveur, dans composer.json, puis lancez composer update :
"config": {
"platform": { "php": "8.3.36" }
}
2. Three things that differ from a usual hostTrois différences avec un hébergeur habituel
- The public folder is called
www/. The account's homec:/user/<compte>/is the project root, and only itswww/folder is served. Rename the framework'spublic/folder towww/:app/,vendor/,.env,storage/orvar/stay out of reach of the web.Le dossier public s'appellewww/. Le répertoire du comptec:/user/<compte>/est la racine du projet, et seul son dossierwww/est servi. Renommez le dossierpublic/du framework enwww/:app/,vendor/,.env,storage/ouvar/restent hors d'atteinte du web. - The database is a folder. Two drivers reach it: SQLite (
pdo_sqlite), whose path points to a folder where Tauri keeps one table per entry — not to a.sqlitefile; or MySQL (pdo_mysql), through Tauri's own MySQL server at127.0.0.1:3306(section 6). There is no PostgreSQL. Do not upload an existing SQLite file: it would not be read.La base de données est un dossier. Deux pilotes y mènent : SQLite (pdo_sqlite), dont le chemin désigne un dossier où Tauri range une table par entrée — pas un fichier.sqlite; ou MySQL (pdo_mysql), par le serveur MySQL propre à Tauri sur127.0.0.1:3306(section 6). Il n'y a pas de PostgreSQL. N'envoyez pas de fichier SQLite existant : il ne serait pas lu. - One zip, unpacked on the server. FTPS sends files one by one; thousands of small files are slow to send. Send one zip, then unpack it over SSH with
unzip.Un seul zip, décompressé sur le serveur. FTPS envoie les fichiers un à un ; des milliers de petits fichiers sont longs à envoyer. Envoyez un zip, puis décompressez-le par SSH avecunzip.
3. The simple way: a shared distribution (no vendor/ to upload)Le plus simple : une distribution partagée (pas de vendor/ à envoyer)
The operator can install ready-made distributions of Laravel and Symfony on the shared code disk @fw:, one per version (paquetadm liste shows them): a complete Composer project with its vendor/, prepared once for every account. Your account then holds only your own code — app/ or src/, config/, routes/, templates/, migrations, .env, www/ — and everything it does not have (all of vendor/) is read from the distribution. Nothing to build on the server, a few dozen files instead of 9,000, and a security fix of the framework is installed once for everybody.
L'opérateur peut installer des distributions toutes prêtes de Laravel et de Symfony sur le disque de code partagé @fw:, une par version (paquetadm liste les montre) : un projet Composer complet avec son vendor/, préparé une fois pour tous les comptes. Votre compte ne garde alors que votre propre code — app/ ou src/, config/, routes/, templates/, migrations, .env, www/ — et tout ce qu'il n'a pas (tout vendor/) se lit dans la distribution. Rien à construire sur le serveur, quelques dizaines de fichiers au lieu de 9 000, et un correctif de sécurité du framework s'installe une fois pour tout le monde.
You can do it yourself, without the operator (22/10/2026): over SSH, siteadm liste shows the installed distributions and their versions, and siteadm laravel or siteadm symfony creates your project in your account — the same thing the operator's compteadm does, acting on your account only.
Vous pouvez le faire vous-même, sans l'opérateur (22/10/2026) : par SSH, siteadm liste montre les distributions installées et leurs versions, et siteadm laravel ou siteadm symfony crée votre projet dans votre compte — la même chose que le compteadm de l'opérateur, sur votre seul compte.
siteadm liste # you: versions installed, default, what your account uses# vous : versions installées, défaut, ce qu'emploie votre compte
siteadm laravel # you: your project on the default Laravel distribution# vous : votre projet sur la distribution Laravel par défaut
siteadm symfony --version 7.4.21 # you: on a given version; on an existing project, switches it# vous : sur une version donnée ; sur un projet existant, le bascule
compteadm laravel <compte> # operator: the project on the default Laravel distribution# opérateur : le projet sur la distribution Laravel par défaut
compteadm symfony <compte> --version 7.4.21 # operator: on a given version (Symfony = webapp: Twig, Doctrine, forms, security…)# opérateur : sur une version donnée (Symfony = webapp : Twig, Doctrine, formulaires, sécurité…)
php c:/user/<compte>/artisan migrate --force # you, over SSH (Laravel)# vous, par SSH (Laravel)
php c:/user/<compte>/bin/console cache:clear # you, over SSH (Symfony)# vous, par SSH (Symfony)
CodeIgniter 4 is shared the same way (09/11/2026): siteadm codeigniter --url https://<your domain> creates the project (the appstarter, public/ renamed www/); its .env already holds the encryption key, drawn on the server, and app.baseURL (CodeIgniter builds its links from it, hence --url; the operator's compteadm codeigniter <compte> takes the account's domain). The database is SQLite in writable/; for MySQL, the commented lines of .env point it to Tauri's server. Then send your app/ by FTPS and run php c:/user/<compte>/spark migrate --all.
CodeIgniter 4 est partagé de la même façon (09/11/2026) : siteadm codeigniter --url https://<votre domaine> crée le projet (l'appstarter, public/ renommé www/) ; son .env porte déjà la clé de chiffrement, tirée sur le serveur, et app.baseURL (CodeIgniter fabrique ses liens à partir d'elle, d'où --url ; le compteadm codeigniter <compte> de l'opérateur prend le domaine du compte). La base est en SQLite dans writable/ ; pour MySQL, les lignes en commentaire du .env la dirigent vers le serveur de Tauri. Envoyez ensuite votre app/ par FTPS et lancez php c:/user/<compte>/spark migrate --all.
On your computer, work with exactly the same versions (ask the operator for the distribution's composer.lock, or create the project with the same version), then send only your own folders over FTPS — never vendor/. The .env already has its secret key, drawn on the server. Moving to a newer distribution: compteadm laravel <compte> --version V (operator), then the migrations or cache:clear. You need a Composer package that the distribution does not have? Then the project is no longer shared: upload your complete vendor/ as in sections 4 and 5, and ask the operator to remove the .tauri_coeur marker at the top of your account.
Sur votre ordinateur, travaillez avec exactement les mêmes versions (demandez à l'opérateur le composer.lock de la distribution, ou créez le projet avec la même version), puis envoyez par FTPS seulement vos propres dossiers — jamais vendor/. Le .env a déjà sa clé secrète, tirée sur le serveur. Passer à une distribution plus récente : compteadm laravel <compte> --version V (opérateur), puis les migrations ou cache:clear. Il vous faut un paquet Composer que la distribution n'a pas ? Le projet n'est alors plus partagé : envoyez votre vendor/ complet comme aux sections 4 et 5, et demandez à l'opérateur de retirer le marqueur .tauri_coeur en haut de votre compte.
Example 1: a guestbook with LaravelExemple 1 : un livre d'or avec Laravel
Visitors leave a message, which is stored in the account's database and listed under the form. Four files, sent by FTPS into the account (its home is the project root); FileZilla creates the missing folders. First the table, as a migration, database/migrations/2026_10_22_000000_create_messages_table.php:
Les visiteurs laissent un message, rangé dans la base du compte et affiché sous le formulaire. Quatre fichiers, envoyés par FTPS dans le compte (son répertoire est la racine du projet) ; FileZilla crée les dossiers qui manquent. D'abord la table, sous forme de migration, database/migrations/2026_10_22_000000_create_messages_table.php :
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->string('nom', 60);
$table->text('texte');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('messages');
}
};
The Eloquent model, app/Models/Message.php — $fillable lists the columns a form may fill:
Le modèle Eloquent, app/Models/Message.php — $fillable liste les colonnes qu'un formulaire peut remplir :
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
protected $fillable = ['nom', 'texte'];
}
The routes, routes/web.php (it replaces the distribution's file): the page, and the form's target, which checks the fields before saving:
Les routes, routes/web.php (il remplace le fichier de la distribution) : la page, et la cible du formulaire, qui vérifie les champs avant d'enregistrer :
<?php
use App\Models\Message;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/livre', function () {
return view('livre', ['messages' => Message::latest('id')->take(50)->get()]);
});
Route::post('/livre', function (Request $request) {
$donnees = $request->validate([
'nom' => 'required|max:60',
'texte' => 'required|max:1000',
]);
Message::create($donnees);
return redirect('/livre');
});
The page, a Blade view, resources/views/livre.blade.php. @csrf adds the form's security token; {{ }} escapes the HTML of what visitors type:
La page, une vue Blade, resources/views/livre.blade.php. @csrf ajoute le jeton de sécurité du formulaire ; {{ }} échappe le HTML de ce que tapent les visiteurs :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Livre d'or</title>
</head>
<body>
<h1>Livre d'or</h1>
@if ($errors->any())
<p class="erreur">{{ $errors->first() }}</p>
@endif
<form method="post" action="/livre">
@csrf
<input name="nom" placeholder="Votre nom" value="{{ old('nom') }}">
<textarea name="texte" placeholder="Votre message">{{ old('texte') }}</textarea>
<button>Signer</button>
</form>
@foreach ($messages as $m)
<p class="message"><strong>{{ $m->nom }}</strong>, le {{ $m->created_at->format('d/m/Y à H:i') }} : {{ $m->texte }}</p>
@endforeach
</body>
</html>
Then over SSH, as the account — ssh <compte>@<your domain>, you land in the project root:
Puis par SSH, sous le compte — ssh <compte>@<votre domaine>, vous arrivez à la racine du projet :
php artisan migrate --force # creates the messages table# crée la table messages
php artisan optimize # caches configuration, routes and views# met en cache configuration, routes et vues
Open https://<your domain>/livre and sign. An empty field brings the form back with the error The nom field is required. (Laravel's messages are in English unless you add a translation); a form sent without the page's token is refused with 419. After any change to routes/, config/ or .env, run php artisan optimize again.
Ouvrez https://<votre domaine>/livre et signez. Un champ vide renvoie le formulaire avec l'erreur The nom field is required. (les messages de Laravel sont en anglais tant que vous n'ajoutez pas de traduction) ; un formulaire envoyé sans le jeton de la page est refusé par 419. Après toute modification de routes/, config/ ou .env, relancez php artisan optimize.
Example 2: notes with SymfonyExemple 2 : des notes avec Symfony
A page with a form that adds a note, saved by Doctrine and listed newest first. Three files, sent by FTPS into the account. The Doctrine entity, src/Entity/Note.php — its attributes describe the table:
Une page avec un formulaire qui ajoute une note, enregistrée par Doctrine et listée de la plus récente à la plus ancienne. Trois fichiers, envoyés par FTPS dans le compte. L'entité Doctrine, src/Entity/Note.php — ses attributs décrivent la table :
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class Note
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 200)]
private string $texte = '';
#[ORM\Column]
private \DateTimeImmutable $creeLe;
public function __construct()
{
$this->creeLe = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getTexte(): string
{
return $this->texte;
}
public function setTexte(string $texte): static
{
$this->texte = $texte;
return $this;
}
public function getCreeLe(): \DateTimeImmutable
{
return $this->creeLe;
}
}
The controller, src/Controller/NotesController.php: it builds the form, validates it (not blank, 200 characters at most), saves the note and comes back to the page. 'empty_data' => '' matters: without it an empty field gives null, which setTexte(string) refuses — an error 500 instead of the message This value should not be blank.
Le contrôleur, src/Controller/NotesController.php : il construit le formulaire, le valide (non vide, 200 caractères au plus), enregistre la note et revient à la page. 'empty_data' => '' compte : sans lui un champ vide donne null, que setTexte(string) refuse — une erreur 500 au lieu du message This value should not be blank.
<?php
namespace App\Controller;
use App\Entity\Note;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class NotesController extends AbstractController
{
#[Route('/notes', name: 'notes')]
public function notes(Request $request, EntityManagerInterface $em): Response
{
$note = new Note();
$form = $this->createFormBuilder($note)
->add('texte', TextType::class, [
'label' => 'Nouvelle note',
'empty_data' => '',
'constraints' => [new NotBlank(), new Length(max: 200)],
])
->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em->persist($note);
$em->flush();
return $this->redirectToRoute('notes');
}
return $this->render('notes.html.twig', [
'form' => $form,
'notes' => $em->getRepository(Note::class)->findBy([], ['id' => 'DESC'], 50),
]);
}
}
The Twig template, templates/notes.html.twig:
Le gabarit Twig, templates/notes.html.twig :
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Notes</title>
</head>
<body>
<h1>Notes</h1>
{{ form_start(form) }}
{{ form_row(form.texte) }}
<button>Ajouter</button>
{{ form_end(form) }}
<ul>
{% for note in notes %}
<li class="note">{{ note.texte }} <small>({{ note.creeLe|date('d/m/Y H:i') }})</small></li>
{% endfor %}
</ul>
</body>
</html>
Then over SSH, from the project root: Puis par SSH, depuis la racine du projet :
php bin/console cache:clear # the prod cache now knows the new entity and route# le cache de prod connaît la nouvelle entité et la route
php bin/console doctrine:schema:update --force # creates the note table# crée la table note
Open https://<your domain>/notes. The form is protected the way Symfony 7.4 does it by default (stateless CSRF): the hidden field holds csrf-token and Symfony checks that the request comes from your own site — a form posted from elsewhere is refused (422), a browser has nothing to do. For a project that lives long, prefer migrations to schema:update: php bin/console doctrine:migrations:diff then doctrine:migrations:migrate -n.
Ouvrez https://<votre domaine>/notes. Le formulaire est protégé comme Symfony 7.4 le fait par défaut (CSRF sans état) : le champ caché contient csrf-token et Symfony vérifie que la requête vient de votre propre site — un formulaire posté d'ailleurs est refusé (422), un navigateur n'a rien à faire. Pour un projet appelé à durer, préférez les migrations à schema:update : php bin/console doctrine:migrations:diff puis doctrine:migrations:migrate -n.
4. Laravel
On your computerSur votre ordinateur
composer create-project laravel/laravel monsite # or your existing project# ou votre projet existant
cd monsite
mv public www # the public folder becomes www/# le dossier public devient www/
rm database/database.sqlite # SQLite file of the skeleton: not used# fichier SQLite du squelette : inutile
In www/index.php, tell Laravel where its public folder is, just before the last line:
Dans www/index.php, indiquez à Laravel où est son dossier public, juste avant la dernière ligne :
$app->usePublicPath(__DIR__);
$app->handleRequest(Request::capture());
In .env:
Dans .env :
APP_ENV=production
APP_DEBUG=false
APP_URL=https://www.example.com
DB_CONNECTION=sqlite
DB_DATABASE=database/donnees
Keep the APP_KEY line (create-project generates it; otherwise run php artisan key:generate on your computer). DB_DATABASE is relative to the project root. Sessions, cache and queue may stay on database (their tables are created by the migrations). Then zip the contents of the project folder (not the folder itself), including the hidden files .env and www/.htaccess — it is .htaccess that gives Laravel its clean URLs. On Windows, select everything inside the project folder, then “Compress to ZIP file”.
Gardez la ligne APP_KEY (create-project la génère ; sinon lancez php artisan key:generate sur votre ordinateur). DB_DATABASE est relatif à la racine du projet. Sessions, cache et file d'attente peuvent rester sur database (leurs tables sont créées par les migrations). Zippez ensuite le contenu du dossier du projet (pas le dossier lui-même), fichiers cachés .env et www/.htaccess compris — c'est .htaccess qui donne à Laravel ses URL propres. Sous Windows, sélectionnez tout le contenu du dossier du projet, puis « Compresser dans un fichier ZIP ».
zip -r ../monsite.zip . -x ".git/*" "node_modules/*" # Linux / macOS
On TauriSur Tauri
Send monsite.zip by FTPS to the root of the account (not into www/), then open an SSH session as the account — ssh <compte>@<your domain>, settings in SSH/FTP. You land in the project root; type:
Envoyez monsite.zip par FTPS à la racine du compte (pas dans www/), puis ouvrez une session SSH sous le compte — ssh <compte>@<votre domaine>, réglages dans SSH/FTP. Vous arrivez à la racine du projet ; tapez :
unzip -o -q monsite.zip # several minutes: 9,000 files# plusieurs minutes : 9 000 fichiers
rm monsite.zip # give the space back# rendre la place
mkdir database/donnees # Laravel wants the database folder to exist# Laravel veut que le dossier de la base existe
php artisan migrate --force # create the tables# créer les tables
php artisan optimize # cache configuration and routes# mettre en cache configuration et routes
exit # end the session# fermer la session
Open https://<your domain>/: the Laravel welcome page appears. Once the configuration is cached, a change to .env only counts after a new php artisan optimize.
Ouvrez https://<votre domaine>/ : la page d'accueil de Laravel s'affiche. Une fois la configuration en cache, une modification de .env ne compte qu'après un nouveau php artisan optimize.
5. Symfony
On your computerSur votre ordinateur
composer create-project symfony/skeleton:"7.4.*" monsite # 7.4 LTS, not 8# 7.4 LTS, pas la 8
cd monsite
composer require symfony/orm-pack # Doctrine, if you need a database# Doctrine, s'il vous faut une base
mv public www # the public folder becomes www/# le dossier public devient www/
Also declare that folder in composer.json, so that the recipes of the packages you add later write into www/:
Déclarez aussi ce dossier dans composer.json, pour que les recettes des paquets ajoutés plus tard écrivent dans www/ :
"extra": {
"public-dir": "www",
...
}
The Symfony skeleton has no .htaccess: create www/.htaccess with these three lines, which send every URL that is not a file to index.php:
Le squelette Symfony n'a pas de .htaccess : créez www/.htaccess avec ces trois lignes, qui envoient vers index.php toute URL qui n'est pas un fichier :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
In .env (or .env.local), with a secret of your own — php -r "echo bin2hex(random_bytes(16));" makes one. Doctrine creates the database folder var/donnees by itself.
Dans .env (ou .env.local), avec un secret à vous — php -r "echo bin2hex(random_bytes(16));" en fabrique un. Doctrine crée seul le dossier de la base var/donnees.
APP_ENV=prod
APP_SECRET=<32 hexadecimal characters>
DATABASE_URL="sqlite:///%kernel.project_dir%/var/donnees"
Empty var/cache/, then zip the contents of the project as for Laravel.
Videz var/cache/, puis zippez le contenu du projet comme pour Laravel.
On TauriSur Tauri
unzip -o -q monsite.zip
rm monsite.zip
php bin/console doctrine:schema:update --force # or doctrine:migrations:migrate -n# ou doctrine:migrations:migrate -n
php bin/console cache:clear # prepare the prod cache# préparer le cache de prod
exit
Then open, for example, https://<your domain>/ or one of your routes.
Ouvrez ensuite par exemple https://<votre domaine>/ ou l'une de vos routes.
6. MySQL instead of SQLiteMySQL plutôt que SQLite
Tauri also speaks the MySQL protocol: its mysqld server, at 127.0.0.1 port 3306, serves each account its own databases, kept in c:/user/<compte>/mysql/<base>/. The server knows which account is calling: the user name and password of the connection are not checked, and an account only ever sees its own databases. Use 127.0.0.1, as below. Laravel, in .env:
Tauri parle aussi le protocole MySQL : son serveur mysqld, sur 127.0.0.1 port 3306, sert à chaque compte ses propres bases, rangées dans c:/user/<compte>/mysql/<base>/. Le serveur sait quel compte l'appelle : le nom d'utilisateur et le mot de passe de la connexion ne sont pas vérifiés, et un compte ne voit jamais que ses propres bases. Employez 127.0.0.1, comme ci-dessous. Laravel, dans .env :
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=monsite
DB_USERNAME=monsite # any value: not checked# valeur libre : non vérifiée
DB_PASSWORD=
php artisan migrate --force creates the database if it does not exist yet, then its tables. Symfony, in .env.local, then php bin/console doctrine:database:create --if-not-exists before the migrations:
php artisan migrate --force crée la base si elle n'existe pas encore, puis ses tables. Symfony, dans .env.local, puis php bin/console doctrine:database:create --if-not-exists avant les migrations :
DATABASE_URL="mysql://monsite@127.0.0.1:3306/monsite?serverVersion=8.0.36&charset=utf8mb4"
Doctrine's migrations:diff and schema:validate work on this server. To look at the tables, the operator's phpMyAdmin accepts your account name and password. Cache and sessions may also go to Redis (127.0.0.1:6379, see PHP & apps), when the operator runs it.
Les commandes migrations:diff et schema:validate de Doctrine fonctionnent sur ce serveur. Pour regarder les tables, le phpMyAdmin de l'opérateur accepte le nom et le mot de passe de votre compte. Cache et sessions peuvent aussi aller dans Redis (127.0.0.1:6379, voir PHP & applis), quand l'opérateur le fait tourner.
7. An application in a sub-folder of an existing siteUne application dans un sous-dossier d'un site existant
When the account already serves a site at the root of its domain — a WordPress, for instance — a Laravel or Symfony application can live beside it, under an address such as https://<your domain>/laravel/. The site at the root is not touched: for each URL, the server uses the .htaccess of the deepest folder that has one, so www/laravel/.htaccess handles everything under /laravel/. The project itself stays outside www/; only its public folder goes into the sub-folder:
Quand le compte sert déjà un site à la racine de son domaine — un WordPress, par exemple —, une application Laravel ou Symfony peut vivre à côté, sous une adresse comme https://<votre domaine>/laravel/. Le site de la racine n'est pas touché : pour chaque URL, le serveur retient le .htaccess du dossier le plus profond qui en a un, donc www/laravel/.htaccess prend en charge tout ce qui est sous /laravel/. Le projet lui-même reste hors de www/ ; seul son dossier public va dans le sous-dossier :
c:/user/<compte>/
hello_laravel/ # the project: app/, vendor/, .env… out of reach of the web# le projet : app/, vendor/, .env… hors d'atteinte du web
www/ # the existing site (WordPress…)# le site existant (WordPress…)
laravel/ # the project's public folder: index.php, .htaccess# le dossier public du projet : index.php, .htaccess
Pick a sub-folder name the root site does not use: a WordPress page or post with the same address would no longer be reachable. Avoid names starting with wp-.
Choisissez un nom de sous-dossier que le site de la racine n'emploie pas : une page ou un article WordPress de même adresse ne serait plus joignable. Évitez les noms qui commencent par wp-.
Laravel under /laravel/Laravel sous /laravel/
On your computer, prepare the two folders side by side, as they will be on the server: Sur votre ordinateur, préparez les deux dossiers côte à côte, comme ils seront sur le serveur :
composer create-project laravel/laravel hello_laravel --no-dev # no development tools: 27 MB instead of 75# sans outils de développement : 27 Mo au lieu de 75
mkdir -p www
mv hello_laravel/public www/laravel # the public folder# le dossier public
rm hello_laravel/database/database.sqlite
mkdir hello_laravel/database/donnees # the database folder# le dossier de la base
In www/laravel/index.php, the three paths __DIR__.'/../ now lead to the project, two levels up, and the public folder is declared just before the last line:
Dans www/laravel/index.php, les trois chemins __DIR__.'/../ mènent désormais au projet, deux niveaux plus haut, et le dossier public est déclaré juste avant la dernière ligne :
if (file_exists($maintenance = __DIR__.'/../../hello_laravel/storage/framework/maintenance.php')) {
...
require __DIR__.'/../../hello_laravel/vendor/autoload.php';
...
$app = require_once __DIR__.'/../../hello_laravel/bootstrap/app.php';
$app->usePublicPath(__DIR__);
$app->handleRequest(Request::capture());
In hello_laravel/.env, the settings of section 4, with the sub-folder in the address and in the path of the session cookie, which then does not mix with the root site's:
Dans hello_laravel/.env, les réglages de la section 4, avec le sous-dossier dans l'adresse et dans le chemin du cookie de session, qui ne se mêle alors pas à celui du site de la racine :
APP_ENV=production
APP_DEBUG=false
APP_URL=https://www.example.com/laravel
DB_CONNECTION=sqlite
DB_DATABASE=database/donnees
SESSION_PATH=/laravel
Routes are written relative to the sub-folder: / is https://<your domain>/laravel/. A first page, in hello_laravel/routes/web.php:
Les routes s'écrivent relativement au sous-dossier : / est https://<votre domaine>/laravel/. Une première page, dans hello_laravel/routes/web.php :
Route::get('/', function () {
return 'Hello World';
});
Route::get('/hello/{nom}', function (string $nom) {
return 'Hello ' . e($nom); # e() escapes the HTML# e() échappe le HTML
});
Zip the two folders together, from the folder that holds them (on Windows: select hello_laravel and www, then “Compress to ZIP file”):
Zippez les deux dossiers ensemble, depuis le dossier qui les contient (sous Windows : sélectionnez hello_laravel et www, puis « Compresser dans un fichier ZIP ») :
zip -r hello_laravel.zip hello_laravel www/laravel
Send hello_laravel.zip by FTPS to the root of the account, then over SSH:
Envoyez hello_laravel.zip par FTPS à la racine du compte, puis par SSH :
unzip -o -q hello_laravel.zip # adds hello_laravel/ and www/laravel/ — the rest of www/ is not touched# ajoute hello_laravel/ et www/laravel/ — le reste de www/ n'est pas touché
rm hello_laravel.zip
php hello_laravel/artisan migrate --force
php hello_laravel/artisan optimize
exit
Open https://<your domain>/laravel/, then /laravel/hello/World.
Ouvrez https://<votre domaine>/laravel/, puis /laravel/hello/World.
Symfony under /symfony/Symfony sous /symfony/
composer create-project symfony/skeleton:"7.4.*" hello_symfony # 7.4 LTS, not 8# 7.4 LTS, pas la 8
mkdir -p www
mv hello_symfony/public www/symfony # the public folder# le dossier public
The public folder is now two levels away from the project. Say so in hello_symfony/composer.json:
Le dossier public est désormais à deux niveaux du projet. Indiquez-le dans hello_symfony/composer.json :
"extra": {
"public-dir": "../www/symfony",
...
}
and in www/symfony/index.php:
et dans www/symfony/index.php :
require_once dirname(__DIR__, 2).'/hello_symfony/vendor/autoload_runtime.php';
Create www/symfony/.htaccess with the three lines of section 5, and set APP_ENV=prod and APP_SECRET in hello_symfony/.env. Symfony finds the sub-folder by itself; its routes, too, are relative to /symfony/. A first controller, hello_symfony/src/Controller/HelloController.php:
Créez www/symfony/.htaccess avec les trois lignes de la section 5, et réglez APP_ENV=prod et APP_SECRET dans hello_symfony/.env. Symfony trouve seul le sous-dossier ; ses routes aussi sont relatives à /symfony/. Un premier contrôleur, hello_symfony/src/Controller/HelloController.php :
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HelloController
{
#[Route('/')]
public function accueil(): Response
{
return new Response('Hello World');
}
#[Route('/hello/{nom}')]
public function hello(string $nom): Response
{
return new Response('Hello ' . htmlspecialchars($nom));
}
}
Zip hello_symfony and www/symfony together as for Laravel (zip -r hello_symfony.zip hello_symfony www/symfony), send the zip to the root of the account, then over SSH:
Zippez hello_symfony et www/symfony ensemble comme pour Laravel (zip -r hello_symfony.zip hello_symfony www/symfony), envoyez le zip à la racine du compte, puis par SSH :
unzip -o -q hello_symfony.zip
rm hello_symfony.zip
php hello_symfony/bin/console cache:clear
exit
Open https://<your domain>/symfony/, then /symfony/hello/World. Both applications can share the account: each zip only adds its own two folders.
Ouvrez https://<votre domaine>/symfony/, puis /symfony/hello/World. Les deux applications peuvent partager le compte : chaque zip n'ajoute que ses deux dossiers.
8. Updating the siteMettre le site à jour
Zip only what changed (for instance app/ and routes/, or src/ and templates/), send it, and unpack it with unzip -o, which overwrites. Then run the migrations again and rebuild the caches: php artisan optimize for Laravel, php bin/console cache:clear for Symfony. After a composer update on your side, send vendor/ again.
Zippez seulement ce qui a changé (par exemple app/ et routes/, ou src/ et templates/), envoyez, et décompressez avec unzip -o, qui écrase. Relancez ensuite les migrations et refaites les caches : php artisan optimize pour Laravel, php bin/console cache:clear pour Symfony. Après un composer update chez vous, renvoyez vendor/.
9. If something goes wrongEn cas de problème
| SymptomSymptôme | What to doQue faire |
|---|---|
| Error 500Erreur 500 | Read the framework's log over FTPS: storage/logs/laravel.log or var/log/prod.log; what escapes the framework is in logs/php_errors_<date>.log (PHP errors). To see the error in the page, set APP_DEBUG=true for a moment (Laravel: then php artisan optimize) — never on a public site.Lisez le journal du framework par FTPS : storage/logs/laravel.log ou var/log/prod.log ; ce qui échappe au framework est dans logs/php_errors_<date>.log (Erreurs PHP). Pour voir l'erreur dans la page, mettez un instant APP_DEBUG=true (Laravel : puis php artisan optimize) — jamais sur un site public. |
Upload refused with 552Envoi refusé avec 552 | The quota is full: delete the old zip, or ask the operator for more.Le quota est plein : effacez l'ancien zip, ou demandez-en plus à l'opérateur. |
could not find driver, Connection refused | A PostgreSQL setting is left somewhere (.env, config/): there is none. For MySQL or Redis, the host must be 127.0.0.1 (section 6), and the operator must be running the server.Il reste un réglage PostgreSQL quelque part (.env, config/) : il n'y en a pas. Pour MySQL ou Redis, l'hôte doit être 127.0.0.1 (section 6), et l'opérateur doit faire tourner le serveur. |
| Only the home page worksSeule la page d'accueil répond | www/.htaccess is missing (hidden files are easy to leave out of a zip).www/.htaccess manque (les fichiers cachés s'oublient facilement dans un zip). |
Under /laravel/, the root site answers instead of the applicationSous /laravel/, le site de la racine répond à la place de l'application | The sub-folder has no .htaccess (www/laravel/.htaccess, www/symfony/.htaccess): the server then falls back on the root one.Le sous-dossier n'a pas de .htaccess (www/laravel/.htaccess, www/symfony/.htaccess) : le serveur se rabat alors sur celui de la racine. |
A page is stopped after 30 s of CPU time (raise it with set_time_limit() or in .user.ini); a form with files is limited to 8 MB, an ordinary form to 8 MB, another request body to 64 MB (PHP & apps). An account has no resident process and no scheduled task of its own: set QUEUE_CONNECTION=sync for Laravel, and run heavy work from the SSH console. The extensions are those of PHP & apps — notably no intl (except Normalizer); sodium is there.
Une page est arrêtée au bout de 30 s de temps processeur (à relever par set_time_limit() ou dans .user.ini) ; un formulaire avec fichiers est limité à 8 Mo, un formulaire ordinaire à 8 Mo, un autre corps de requête à 64 Mo (PHP & applis). Un compte n'a ni processus résident ni tâche planifiée à lui : mettez QUEUE_CONNECTION=sync pour Laravel, et lancez les traitements lourds depuis la console SSH. Les extensions sont celles de PHP & applis — notamment pas d'intl (hors Normalizer) ; sodium est là.