0
votes

mautic throws amazing error during installation :

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.

so i went into server log which shows :

PHP Warning: include(): Failed opening '/var/www/myfolder/var/cache/prod/middlewares.cache.php' for inclusion (include_path='.:/usr/share/php') in /var/www/myfolder/app/middlewares/MiddlewareBuilder.php on line 82PHP message: PHP Warning - Invalid argument supplied for foreach() - in file /var/www/mauticwp/app/middlewares/MiddlewareBuilder.php - at line 84PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/mauticwp/app/middlewares/MiddlewareBuilder.php on line 84PHP message: RuntimeException: Unable to create the "cache" directory (/var/www/myfolder/var/cache/prod). - in file /var/www/myfolder/vendor/symfony/http-kernel/Kernel.php - at line 765'

    #NameVirtualHost *:8000
<VirtualHost *:8000>

        ServerAdmin webmaster@localhost
        ServerName somesubdomain.ndedges.com
        ServerAlias www.mautic.ndedges.com
        DocumentRoot /var/www/some_directory
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

    <IfModule mpm_itk_module>
        AssignUserId mauticadmin www-data
    </IfModule>


        <IfModule mod_fastcgi.c>
                AddHandler php7.4-fcgi .php
                Action php7.4-fcgi /php7.4-fcgi virtual
                Alias /php7.4-fcgi /usr/lib/cgi-bin/php7.4-fcgi-mautic.ndedges.com
                FastCgiExternalServer /usr/lib/cgi-bin/php7.4-fcgi-test.com -socket /var/run/php/php7.4-fpm-mautic.ndedges.com.sock -pass-header Authorization
        </IfModule>
     <Directory /var/www/some_directory>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>

    <FilesMatch .php$>
        # 2.4.10+ can proxy to unix socket
         SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>
</VirtualHost>

within fpm/pool.d/www.mautic.conf. i added

    php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off

as I have multiple PHP in the same server. I have Cloudflare configured within WordPress and redirects to HTTPS. but i am unable to use ip and port to use it.

I am completely clueless about what could be the reason.

thx sayantan

3
Failed opening indicates that either the file doesn't exist or your web server process doesn't have permission to read it.Alex Howansky

3 Answers

1
votes

Most of the time it is Cache and Permission related Issue, In my opinion It has nothing to do with Apache configuration.

  • Use ps aux to identify which user owns the apache process,
  • Mostly it is www-data,
  • Make sure to chown on all directories and sub directories to change ownership to www-data.
  • Make sure files and directories have proper permissions for www-data, Mautic needs write access to Media, var/cache and var/logs directories.

https://tutorialsjoint.com/install-mautic/ in this tutorial checkout the section "Setting rights and permissions for Mautic Installation".

It'll work the same weather it is nginx or apache as this problem seems to be linux related only.

0
votes

i also find some error

 [mpm_prefork:notice] [pid 1440453] AH00163: Apache/2.4.41 (Ubuntu) mod_fcgid/2.3.9 mpm-itk/2.4.7-04 OpenSSL/1.1.1f configured -- resuming normal operations

<FilesMatch ".php$"> # Apache 2.4.10+ can proxy to unix socket SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/"

this one did the job. i removed that fpm configuration but it works like a charm. actually, the same settings did not work for him but it worked for me.

ref: https://askubuntu.com/questions/1317077/apache-sethandler-not-working-with-multiple-php-version

maybe due to the apache2 version. but it has a different problem now i can access it through elastic ip and non SSL port but not with the A record.

now mautic is set with SES but i need to set a bounce endpoint with sns topic. and set a cronjob as www-data.

0
votes

I was able to access with the IP not using the SSL of Cloudflare proxied A record because it doesn't support other than these ports to trust support.cloudflare.com/hc/en-us/articles/… Cloudflare only accept these ports nothing else. After changing those it was immediately turned into grey and secured. –

https://community.cloudflare.com/t/subdomains-are-not-getting-redirected-to-themselves/279745