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

Trouble with constants not loading

Like many others I have had trouble with the constants loading, I followed one of the examples mentioned by someone else for the same question to change the constants to variables instead of using define but then in the apache error log I get;

[Tue Apr 12 12:01:31.556525 2016] [:error] [pid 3041] [client 127.0.0.1:55154] PHP Warning:  include(): Failed opening '/var/www/html/mike.com/shirts4mike_local/inc/header.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/mike.com/receipt/index.php on line 5
[Tue Apr 12 12:01:31.556547 2016] [:error] [pid 3041] [client 127.0.0.1:55154] PHP Warning:  include(/var/www/html/mike.com/shirts4mike_local/inc/footer.php): failed to open stream: No such file or directory in /var/www/html/mike.com/receipt/index.php on line 26
[Tue Apr 12 12:01:31.556556 2016] [:error] [pid 3041] [client 127.0.0.1:55154] PHP Warning:  include(): Failed opening '/var/www/html/mike.com/shirts4mike_local/inc/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/mike.com/receipt/index.php on line 26

If use used the define keyword for the constants in the apache error log I get the same error. At first I was getting a white screen, but that was due to some syntax error. However now I get the thank you page but no styles and as explained in the error log no header and footer.

I have another question. As I am using LAMP and have set up a virtual host for shirtsformike.com locally on my computer. Do I need to do all of this? As it worked fine for me simply using root-relative paths, or even relative paths.