First I would like to describe the normal procedure to install TYPO3 with composer:
- Install composer on the server so you have the command „composer“ or „composer.phar“ or in a ddev environment „ddev composer“ available. (In the case of ddev just in the terminal on you computer without the need for SSH).
- cd into the folder where you want to install TYPO3 (on Apache usually „/html“)
composer create-project "typo3/cms-base-distribution:^12.4" my-new-project
will create a basic setup inside a new folder „my-new-project“- cd into „my-new-project“-Folder and then into the folder „public“ (this is the future root for your Domain“
- create inside „public“ a file called „FIRST_INSTALL“ e.g.
touch FIRST_INSTALL
- create an empty database and write down the access details
- connect your domain to the public folder
- open the domain in a browser and go through the TYPO3 install menu (add the database access credentials)
- Edit the composer.json inside the „my-new-project“ folder to your needs, with the extensions you want to use
- connect via SSH and cd into the folder „my-new-project“
- in the Terminal
composer update
orcomposer.phar update
according to your composer installation - You have now a fully working TYPO3 composer installation
What is different with Plesk?
In my case at the Swiss provider iWay the SSH-connection goes to a „chroot“ area with now access to composer or directly to PHP.
„chroot“ – „change root“ means SSH can only go back to a certain root and can not access the whole server. So folders like „usr“, „var“ or „bin“ are out of reach. iWay is also not allowing any composer commands inside the SSH chroot area.
The customer area is managed by the Plesk software. And Plesk is offering an extension that manages composer. But differently then with direct commands in the terminal.
Plesk Composer is offering a graphical user interface.
click on PHP Composer
IMPORTANT to UNDERSTAND!
In Plesk there is a folder with the same name as the domain it belongs to. In this folder the domain data is expected. Domain „my-domain.de“ has the folder „my-domain.de“.
NEVER CHANGE the name of this folder!!!
When you open the Composer window within Plesk for the first time, Plesk Composer has not yet found the „composer.json“ settings file. The „Edit composer.json“ button is then called „Search for a composer.json“. Plesk-Composer then searches in the current folder, which has the same name as the domain, and writes the path to an internal sqlite composer database. If you would change the name of this folder, then the next time you open the Plesk-composer window the composer.json is not found. If you then press again the „search for a composer.json“ button, composer will start searching at the chroot starting point. The first composer.json file that will be found (e.g. in a folder with the name „additional-files“ – „a“ is at the beginning of the alphabet) will then be used for your installation, even if it is a completely different composer.json, that has nothing to do with your TYPO3 installation.
Naming the folder again with it’s original name didn’t help in my case. The support had to change the settings in the sqlite database.
NEW
Underneath the button „Edit composer.json“ is a word in square brackets „[change]“, if you click on this button, you will get a list where you can choose a composer.json. If your respective file is not listed, choose a folder that is high up in the hierachy of the chroot area. And then try again until you see your folder with your composer.json. This means choosing the wrong composer.json until the list gives you the possibility to choose the right one.
This can all be avoided if you do not change the name of the domain-name folders! If you search in the internet for „plesk composer.json not found“ you will find a lot of people who got stuck.
So, from scratch, how to install TYPO3 in composer mode with a server setup that is managed by Plesk and a SSH area that is not allowing the composer command
- make sure that your Plesk has the composer plesk extension installed
- create a subdomain with e.g. „t12.my-domain.de“ („t12“ stands for TYPO3 12 in a a case where the main folder already has an old TYPO3 installation)
- Plesk will create automatically a folder with the name „t12.my-domain.de“
- create a composer.json with all demands for installation
- use SFTP to upload this composer.json into the folder „t12.my-domain.de“
- go back to Plesk and Plesk-Composer in the area of „t12.my-domain.de“, press the search button
- if you got the right composer.json you will nicely see all modules and extensions listed with an explanation and information
- Press the install button
- Composer will install TYPO3 and all the extensions inside the folder „t12-my-domain.de“
- go through the TYPO3 installation process (see above: FIRST_INSTALL in the public folder, Sub-Domain pointing to the public folder, in the browser install …)
- if you have changes you can edit the composer.json directly inside Plesk and then press update
- you only have two composer commands „install“ and „update“, everything else must be managed via the composer.json
- when you are done, point the domain „my-domain.de“ to the folder „t12.my-domain.de“
- if you want to install TYPO3 13 start with a new sub-domain and a sub-domain folder automatically created by Plesk