Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

White screen of death?

I had a white screen of death and when I read up about I added the code;

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

to the top of my index.php to display the errors. The first was a syntax error and I sorted that out. The second error keeps priniting the result;

Fatal error: Class 'Twig_Node_Expression_Constant' not found in /var/www/vendor/twig/twig/lib/Twig/ExpressionParser.php on line 206

I am not sure what this means or is going on here. I have just moved this site from XAMPP in windows environment to LAMP in linux so not sure if this has anything to do with. As it was working before hand in the windows environment.

1 Answer

Chris McKnight
Chris McKnight
11,045 Points

This is usually caused by either a missing require statement or a problem with your autoloader.

When you moved platforms, the autoloader generated Windows specific paths for your autoloader file. These paths would be wrong on a different when switching from Windows to *nix or vice versa.

Mayur Pande
Mayur Pande
Courses Plus Student 11,711 Points

Thanks for the answer I managed to sort the problem out yesterday. It was part to do with you said. With regards to what you said I simply copied the composer.json file over and did a composer update in linux. That solved my first problem. At this point it loaded up just the home page however if I tried to navigate to another page in the menu I would get a 404 error. After extensive reading and trial and error. I found out that in order for apache to work with htaccess files, the code below needs to be changed in the /etc/apache2/apache2.conf and /etc/apache2/sites-available/000-default.conf (I had previously copied this file over to /etc/apache2/sites-available/mysite.conf as suggested in the ubuntu installation instructions)

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

the above had to be changed to

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

in the files mentioned above.