Fresh Mautic 4.4.0 via SSH and Composer - problem with installation

Your software
My PHP version is : 7.4.30
My MySQL/MariaDB version is (delete as applicable): MariaDB version 10.2

Updating/Installing Errors
*I am: Installing
*Installing via: Command Line

These errors are showing in the installer :

Your problem

I try to set up a new installation of Mautic v 4.4.0 according to instruction from Installing with Composer | Mautic

I decided to use Recommended Project way. I’ve run ‘php composer.phar create-project mautic/recommended-project:^4 mautic --no-interaction’ command (but in my case I’ve change the name of ‘some-dir’ to ‘mautic’ so my installation is in public_html/mautic/docroot).

During the installation I came across few messages which did not allowed me to fully install the Mautic 4.4.0

These are the “yellow”messages

I can not move forward. Usually, after doing this process via command line there was a list of “Next steps” which tells to setup Mautic via browser. Now, there is no such list and don’t know what to do next. Obviously, The Recommended project did not install Mautic as it was told in documentations.

I also did this:

cd mautic
php composer.phar require mautic/mautic-saelos-bundle:~2.0

But those errors occured this time:

Can you help? How to install fresh copy of Mautic 4.4.0 with Composer?

I am no coder so I would appreciate any step by step hints.

Kind regards, Greg

Steps I have tried to fix the problem : Run this command via SSH ‘php composer.phar create-project mautic/recommended-project:^4 mautic --no-interaction’ and you will see this messages

Are you using shared host like cPanel?

No, I do not use share hosting. I work on cloudways.com.

Ignore the previous instruction and try this instruction on Mautic Github instead

Thank you, but do not know what to do. If I clean my public_html folder and want to start from the fresh beginning via ssh …can you tell me what should I enter in my PuTTY console step by step to make the Mautic install correctly?

Do you mean that I sould do the installation this way:

New installations
  • Run the create-project command without installing
    composer create-project mautic/recommended-project:^4.0 some-dir --no-interaction --no-install
    
  • Do a find and replace in the composer.json file to change docroot/ into public/.
  • Review the changes in the composer.json file to ensure there are no unintentional replacements.
  • Run composer install to install all dependencies in the correct location.

?

Correct

But instead of renaming it to public rename it to public_html

Then do a composer install in the folder outside of public_html

Thank you.

Still confused because if I run ‘composer create-project mautic/recommended-project:^4.0 some-dir --no-interaction --no-install’ it will put the composer.json file in the public_html folder so I would not be able to run composer install outside the public_html.

Would you be so kind to provide me with the exact commands you would enter in the PuTTY console to obtain this goal?

This is the look at my FTP (FileZilla view below). I want to install Mautic to the “hjgfecmjsc” folder.
obraz

Please, provide me with all commands you would use to fully and correctly install Mautic with Composer starting here:
obraz

I have to add that, if I find a composer.json file I will be able to do a “find and replace” action myself:)

I would be grateful for your help and hope your instructions will help a lot of people who cope with the same problem.

Greg

Dear techbill

I faced one problem: Permission denied to install anything inside the application folder. In my case I’m unable to run composer install outside the public_html folder.

Nevertheless I tried your way with the hope I would manage to achieve the goal.

For the first approach I got two folders after installation → public_html/public_html/

I decided to try other way:
What I did:
In public_html I run this command: php composer.phar create-project mautic/recommended-project:^4.0 mautic --no-interaction --no-install

obraz

Then, in composer.json file, instead of doing replacement I delete the “docroot/” and saved the .json file. In the composer.json file now I got:
“autoload”: {
“psr-4”: {
“MauticPlugin\”: “plugins/”
}
},
“extra”: {
“mautic-scaffold”: {
“locations”: {
“web-root”: “”
}
},
“installer-paths”: {
“app”: [
“type:mautic-core”
],
“plugins/{$name}”: [
“type:mautic-plugin”
],
“themes/{$name}”: [
“type:mautic-theme”

Than I run command php composer.phar install inside the public_html folder.

Installation went well till the ending message:

Installation of Mautic via browser didn’t worked out as

Can you tell is there a way to do it correctly in my case?

In USA, it’s a holiday weekend but I will get back with your post soon.

If you can only run the composer in within the public_html folder then edit the composer.json file and use the absolute path instead of deleting anything.

You will need to edit more than one line in composer.json file to update it with absolute path names.

Here an partial example from composer.json

Partial edit around line 90 to line 112 or so … Find all path and edit to change to the absolute path to your public_html folder

This is only an example so you will need to know your absolute path to edit it property for your server. Once you edited your composer.json then you can place composer.json inside your public_html folder and do a composer install from there.

"autoload": {
    "psr-4": {
      "MauticPlugin\\": "/home/username/public_html/plugins/"
    }
  },
  "extra": {
    "mautic-scaffold": {
      "locations": {
        "web-root": "/home/username/public_html/"
      }
    },
    "installer-paths": {
      "/home/username/public_html/app": [
        "type:mautic-core"
      ],
      "/home/username/public_html/plugins/{$name}": [
        "type:mautic-plugin"
      ],
      "/home/username/public_html/themes/{$name}": [
        "type:mautic-theme"
      ]
    },

Dear techbill!

Thank you for your invaluable tips!
I followed what you provided.

  1. In the public_html folder, I ran the command

composer create-project mautic/recommended-project:^4.0 mautic-to-install --no-interaction --no-install

  1. I edited the composer.json file and replaced “docroot” with an absolute path, which in my case looks like this: /home/master/applications/hjgfecmjsc/public_html

“autoload”: {
“psr-4”: {
“MauticPlugin\”: “/home/master/applications/hjgfecmjsc/public_html/plugins/”
}
},
“extra”: {
“mautic-scaffold”: {
“locations”: {
“web-root”: “/home/master/applications/hjgfecmjsc/public_html/”
}
},
“installer-paths”: {
“/home/master/applications/hjgfecmjsc/public_html/app”: [
“type:mautic-core”
],
“/home/master/applications/hjgfecmjsc/public_html/plugins/{$name}”: [
“type:mautic-plugin”
],
“/home/master/applications/hjgfecmjsc/public_html/themes/{$name}”: [
“type:mautic-theme”
]
},

  1. I saved the changed composer.json file directly to the public_html directory and ran the

composer install

command.

Here you can see the process (to watch) → Recordit: Record screencasts fast & free! with GIF Support!

I looked at the FTP site. I was surprised. An unnamed directory was created, where I think Mautic was implemented.

See here:
obraz

I can’t run the Mautic installation through the browser.

However, it seems that something in the composer.json file would still need to be changed in order for Mautic to implement itself directly in the public_html directory and not create a new (unnamed) directory, which you can see in the above screenshot.

Can I ask you for further help in figuring out what to do differently this time to properly install Mautic?

Kind regards,

Greg

1 Like

have you sorted out? same problem here

Let me do a fresh install on cPanel server that not currently in use … give me 15 minutes or around and I will see if there were something introduced into the latest composer install.

Mine seems to be working fine … https://deafcoder.com

I am attaching a copy of mine. - https://deafcoder.com/composer.zip

First, go in terminal to your public_html folder and if you still have old composer.json file in there then type this command:

realpath composer.json

It should print out the real path of your composer.json. Edit my composer.json and replace my real path with your real path but don’t include the “composer.json”. Only edit the path then save and upload it to your server.

Type this command:

composer install --no-interaction

If it doesn’t work then you probably will have to get a different host to use Mautic. Mautic developers does not offer support on shared host.

One last thing to make sure your composer is at least version 2 and higher

Type this command:

composer --version

Hello techbill!

I have tested Mautic few months ago on my server and it was possible to install it on it without problems. Hosting is telling: “nothing has changed since that time.”
My Composer version is 2.7

So I did like this.

  1. I have emptied the whole public_html folder for clean installation.
  2. Edited your composer.json file with my real path which occurred to be /home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/

“autoload”: {
“psr-4”: {
“MauticPlugin\”: “/home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/plugins/”
}
},
“extra”: {
“mautic-scaffold”: {
“locations”: {
“web-root”: “/home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/”
}
},
“installer-paths”: {
“/home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/app”: [
“type:mautic-core”
],
“/home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/plugins/{$name}”: [
“type:mautic-plugin”
],
“/home/555677.cloudwaysapps.com/hjgfecmjsc/public_html/themes/{$name}”: [
“type:mautic-theme”
]
},

  1. Than, I just uploaded composer.json file to clean public_html folder and run the command

composer install --no-interaction

Here is how the process run → Recordit: Record screencasts fast & free! with GIF Support!

  1. After all I was able to install Mautic via browser → Ready to install!

Thank you so, so, so much for your help! It worked out! :grinning: :grinning: :grinning: :+1: :+1: :+1:

If you could support me with one more thing…

Considering all future updates of Mautic:

What command should I run in my console inside public_html folder to update Mautic to higher versions when they will be released?

2 Likes

You’re welcome

For me. it’s

composer update

Some update might need database to be migrated and cache emptied so there are other commands you would want to know when doing a update …

Here some info about updating

Installing with Composer | Mautic.

Hello!

I have run command:

composer update

It worked I think…
…but than I try to run 5 commands that are suggested to run in the 5th point on the list of Updating Mautic Core taken from Installing with Composer | Mautic
If you could watch the process here: Recordit: Record screencasts fast & free! with GIF Support! and tell me why there are all “Permission denied” and what to do to run this five commands properly?

Try adding
php
at the beginning of command and not all commands need to be run at every update …

One of the command that should be run after every update is clear cache so add php like this and see if that works for you,

php bin/console cache:clear