Mautic Community Forums

Set up Mautic dev environment quickly

Hello, I’m an experienced Mautic user and have been using it for months for team’s projects. Today I want to set up my dev environment from scratch with the latest ‘staging’ branch. The web installer works fine, while I had to go back and forth to fix various permission issues during this process. Especially some errors were not showing on the page directly, instead, you have to ‘tail’ the Apache error log to discover it.



After it’s all done, I managed to come up with a script with all the commands needed to fix the permission issues, I hope it would be helpful for the others. As you can see from the script, my workaround to make those special directories writable by both my user account and the web daemon process is to change the group owner to the web daemon account, also chmod to 775.



Put the steps and commands below, and it’s also available on gist: https://gist.github.com/Hailong/c705a490d6e1eb31f3402bb19286a16a

Code:
#!/bin/bash

1. Check out the latest code from https://github.com/mautic/mautic

2. Run ‘composer install’ in the root directory as described in the README file.

3. Run the following script to set the folder permissions correctly. NOTE: change the “my_linux_account” and “web_daemon_account” properly according your sever.

my_linux_account=“root”
web_daemon_account=“apache”

touch app/config/local.php
echo “<?php” > app/config/local.php
echo “$parameters = array();” >> app/config/local.php
sudo chown $web_daemon_account:$web_daemon_account app/config/local.php

sudo chown -R $my_linux_account:$web_daemon_account app/cache
chmod -R 775 app/cache

sudo chown -R $my_linux_account:$web_daemon_account app/logs
chmod -R 775 app/logs

mkdir app/spool
sudo chown $web_daemon_account:$web_daemon_account app/spool

sudo chown -R $my_linux_account:$web_daemon_account media
chmod -R 775 media

4. Go to browser and follow the page to finish configuration.

5. Restore the permission of some files that from the repository.

#git checkout – media/.
#git checkout – app/logs/.

Hello, I’m an experienced Mautic user and have been using it for months for team’s projects. Today I want to set up my dev environment from scratch with the latest ‘staging’ branch. The web installer works fine, while I had to go back and forth to fix various permission issues during this process. Especially some errors were not showing on the page directly, instead, you have to ‘tail’ the Apache error log to discover it.

After it’s all done, I managed to come up with a script with all the commands needed to fix the permission issues, I hope it would be helpful for the others. As you can see from the script, my workaround to make those special directories writable by both my user account and the web daemon process is to change the group owner to the web daemon account, also chmod to 775.

Put the steps and commands below, and it’s also available on gist: https://gist.github.com/Hailong/c705a490d6e1eb31f3402bb19286a16a

#!/bin/bash

# 1. Check out the latest code from https://github.com/mautic/mautic

# 2. Run 'composer install' in the root directory as described in the README file.

# 3. Run the following script to set the folder permissions correctly. NOTE: change the "my_linux_account" and "web_daemon_account" properly according your sever.

my_linux_account="root"
web_daemon_account="apache"

touch app/config/local.php
echo "<?php" > app/config/local.php
echo "$parameters = array();" >> app/config/local.php
sudo chown $web_daemon_account:$web_daemon_account app/config/local.php

sudo chown -R $my_linux_account:$web_daemon_account app/cache
chmod -R 775 app/cache

sudo chown -R $my_linux_account:$web_daemon_account app/logs
chmod -R 775 app/logs

mkdir app/spool
sudo chown $web_daemon_account:$web_daemon_account app/spool

sudo chown -R $my_linux_account:$web_daemon_account media
chmod -R 775 media

# 4. Go to browser and follow the page to finish configuration.

# 5. Restore the permission of some files that from the repository.

#git checkout -- media/.
#git checkout -- app/logs/.