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 PHP Basics (Retired) PHP Conditionals & Loops If / ElseIf Conditionals

Parker Brown
Parker Brown
24,308 Points

Workspace error upon preview

Just white space when I go to preview index.php. http://port-80-8t6owyak84.treehouse-app.com/

There's no code to post as I've been getting the same error through out the PHP Basics Track, only occasionally getting my coded file to render. I'm just opening Workspace and hitting preview for the Mike The Frog code already there. At several points along this track workspace has returned the same error, without me touching the index.php file.

2 Answers

Parker Brown
Parker Brown
24,308 Points

That's correct. Got my preview to display after removing all the default/pre-existing PHP code from the file Index.php page. Once I stripped it down to just the HTML skeleton and then added back a block of PHP within the body I was good to go. Thanks for the assist Nathan Williams.

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

Hi Parker,

A white page is generally indicative of an error in your PHP. You can see the exact error message by checking the web server's error log. Let's look at an example...

error log

So in this example, there's a syntax error caused by a stray if on line 68. This causes a white page when trying to preview, so I check the error log by running cat /var/log/httpd-workspaces/error_log at the console, and sure enough, the error log tells me exactly what's wrong!

PHP Parse error:  syntax error, 
unexpected '?>', expecting '(' in /home/treehouse/workspace/index.php on line 68

So, I know there's a syntax error, somewhere on line 68.

Parker Brown
Parker Brown
24,308 Points

That's correct. However, I'm not adding any code to the Workspace index.php file, so unless there's a recurring error in the default Workspace file, I'm stumped. I'm just opening Workspace, going to the index.php file and hitting preview expecting Mike the Frog from Orlando, FL to pop up, and instead getting nothing but the despair of a White Page :(