Mautic Community Forums

Error 500 when 1st call of index.php

Hi,



I have now tried mautic 1.2.1 on my webspace providing php 5.5.26 and apache, but I do receive an error 500 when first time calling index.php

I then have setup a LAMP-server (Ubuntu 14.04 based - turnkeylinux in use) as a VMware-instance, setup a VirtualHost on 8080 pointing its DocumentRoot to the mautic-directory (/var/www/mautic) and I also receive an error 500.



A short instrumenting of index.php shows that I got on the screen:



Step 1Step 2Step 3Step 4

Code:
[index.php] require_once __DIR__ . '/app/AppKernel.php'; //require_once __DIR__.'/mautic/app/AppCache.php'; try { $kernel = new AppKernel('prod', false); printf("Step 1"); $kernel->loadClassCache(); printf("Step 2"); //$kernel = new AppCache($kernel); printf("Step 3"); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); printf("Step 4"); $response = $kernel->handle($request); printf("Step 5"); $response->send(); printf("Step 6"); $kernel->terminate($request, $response); printf("Step 7"); } catch (MauticCoreBundleExceptionDatabaseConnectionException $e) { define('MAUTIC_OFFLINE', 1); $message = $e->getMessage(); include __DIR__ . '/offline.php'; } catch (Exception $e) {

Hi,

I have now tried mautic 1.2.1 on my webspace providing php 5.5.26 and apache, but I do receive an error 500 when first time calling index.php
I then have setup a LAMP-server (Ubuntu 14.04 based - turnkeylinux in use) as a VMware-instance, setup a VirtualHost on 8080 pointing its DocumentRoot to the mautic-directory (/var/www/mautic) and I also receive an error 500.

A short instrumenting of index.php shows that I got on the screen:

Step 1Step 2Step 3Step 4

[index.php] require_once __DIR__ . '/app/AppKernel.php'; //require_once __DIR__.'/mautic/app/AppCache.php'; try { $kernel = new AppKernel('prod', false); printf("Step 1"); $kernel->loadClassCache(); printf("Step 2"); //$kernel = new AppCache($kernel); printf("Step 3"); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); printf("Step 4"); $response = $kernel->handle($request); printf("Step 5"); $response->send(); printf("Step 6"); $kernel->terminate($request, $response); printf("Step 7"); } catch (MauticCoreBundleExceptionDatabaseConnectionException $e) { define('MAUTIC_OFFLINE', 1); $message = $e->getMessage(); include __DIR__ . '/offline.php'; } catch (Exception $e) {

Could you check Mautic logs (/app/logs dir) and server logs if there is some error message which would tell us more?

The /var/www/mautic/app/logs directory is empty.

The apache-logs show:

127.0.1.1:8080 192.168.10.180 - - [02/Nov/2015:16:29:42 +0000] "GET / HTTP/1.1" 302 556 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36" 127.0.1.1:8080 192.168.10.180 - - [02/Nov/2015:16:29:42 +0000] "GET /index.php/ HTTP/1.1" 500 288 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36" 127.0.1.1:8080 192.168.10.180 - - [02/Nov/2015:16:29:45 +0000] "GET /favicon.ico HTTP/1.1" 302 574 "http://192.168.10.140:8080/index.php/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36" 127.0.1.1:8080 192.168.10.180 - - [02/Nov/2015:16:29:45 +0000] "GET /index.php/favicon.ico HTTP/1.1" 500 288 "http://192.168.10.140:8080/index.php/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36"

First, there is the redirection 302, and then the server error 500.

I dived a little bit deeper into the totally unknown debris of php-debugging and enabled in /etc/apache2/apache2.conf:

php_flag display_errors on php_value error_reporting 2039

Restarted apache and now I got for index.php:

code Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 262144 bytes) in /var/www/mautic/app/bootstrap.php.cache on line 2701
Call Stack

Time Memory Function Location

1 0.0041 240144 {main}( ) …/index.php:0
2 0.0697 4289272 AppKernel->handle( ) …/index.php:60
3 0.0705 4300864 AppKernel->boot( ) …/AppKernel.php:71
4 0.1483 6929912 AppKernel->initializeContainer( ) …/AppKernel.php:252
5 1.7009 20393480 SymfonyComponentHttpKernelKernel->dumpContainer( ) …/AppKernel.php:489
6 1.9667 21554616 SymfonyComponentHttpKernelKernel::stripComments( ) …/bootstrap.php.cache:2678
7 1.9668 21555000 token_get_all ( ) …/bootstrap.php.cache:2701
[/code]

This outcome let me increase the memory-size of the virtual machine to 1GB and got the same result.
I then increased the memory-size to 2 GB and again achieved the same error at the same point.

And yes of course, there is enough memory available:

root@lamp ~# cat /proc/meminfo MemTotal: 2061256 kB MemFree: 1809356 kB Buffers: 14680 kB

I then checked this allowed memory-size of 33554432 which represents 32M. And I found in /etc/php5/apache2.ini the entry:

root@lamp php5/apache2# grep "32M" * php.ini:memory_limit = 32M

I increased that to 64M and what should I say, the mautic installation started up.

Would be great if such kind of memory exhaustion errors would be checked. Especially during the installation phase. Additionally it would be worth a hint that could be given to rookies like me.

I’m sorry for your troubles. Hopefully, your investigation helps others. As you suggested, I added the warning message if the memory_limit setting is lower than 128 MB. It will be available in Mautic 1.2.3:

https://github.com/mautic/mautic/pull/1124