Search code examples
phpmamp

Site running under MAMP dies when ob_get_clean is called


I'm running MAMP with PHP version 5.5.10. PHP and Apache are both working, except on pages that call ob_start() and ob_get_clean():

<?php
if (array_key_exists('DOCUMENT_ROOT', $_SERVER))
    include("{$_SERVER['DOCUMENT_ROOT']}/php-libs/setup.php");
else {
    // use include path - under CGI
    include("php-libs/setup.php");
}

$page = $site->page();
$page_info = array(
    'title' => 'Welcome!',
    'page_title' => '',
    'page_subtitle' => '',
    'page_type' => 'homepage',
    'body_class' => 'home full'
);

$page->setup($page_info);

ob_start();
?>

<p>Hello World!</p>

<?php
$page->setContent(ob_get_clean());
$page->display();

The result is that I get a 200 response but no page content and no errors. Nothing shows up in the PHP or Apache error log, so I'm at a complete loss. I've tried multiple different PHP versions and it doesn't seem to matter.

If I comment out the $page->setContent(ob_get_clean()); line then the page loads but the included files aren't included.

Here is my phpinfo output: http://jsfiddle.net/LeyLcr5f/embedded/result/

Also, a colleague of mine is using the same repo on his machine with MAMP PRO without an issue (we're both running OS X Mavericks).


Solution

  • This looks like a library I've used in the past. Try making sure that the web server has write access to the smarty/templates_c directory.