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

melissa brown
melissa brown
4,670 Points

xxamp/php browser viewing not working blank screen.

i install xxamp and have mike local server up and running and did the 'mikes tshirt test site' and it works fine. But when i try to load my wordpress site it doesnt work. i just get this error msg

"Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\treehouse-portfolio\index.php on line 1"

i am currently doing the wordpress theme development course. the thing is i get this msg whether i am loading the final project files treehouse-portfolio (which is not my code) or if i load my own code.

10 Answers

Clinton Hopgood
Clinton Hopgood
7,825 Points

Simply put, xampp and your cyberduck hosting are completely separate. Both are web servers however one is on the web (where anyone can reach it) and the other is only on your computer (only you can reach it).

You can develop within your xampp environment and then move it to your cyberduck once it's ready. This will allow you to have direct access to the files without needing to use FTP until the point that you move them.

I have discovered a cool program though which I actually really like and am using for my self, it's called netdrive. It lets you map your webserver as a local drive on your computer so you can work on the files as though they're on your computer (even though they're on the cyberduck web host), using sublime or which ever editor you like. It's just slightly slow when saving files as it has to write to a server rather than your computer.

http://www.netdrive.net/

melissa brown
melissa brown
4,670 Points

i cant push the admin button on my xxamp. i can only push the apache admin button

Clinton Hopgood
Clinton Hopgood
7,825 Points

do you have a header.php file in your theme directory?

The function get_header() is used to include the header.php on your index.php in this case.

Clinton Hopgood
Clinton Hopgood
7,825 Points

Let me get some more info.

Q1. This is on your windows computer and you're using xxamp?

Q2. Did you install Wordpress? Including creating a databse and modifying the wordpress config file?

melissa brown
melissa brown
4,670 Points

i am using windows and yes i am using xxamp

i did the one click wordpress intall. through cpanel and i can login into my wordpress site no problems. (so i am not sure if that created a database automatically or modified the confige process. if i log into cpanel and go into MySQL Databases i have a database set up automatically however i cant see where the password to this is.

Clinton Hopgood
Clinton Hopgood
7,825 Points

CPanel one click install sounds like you installed wordpress on a webserver. Do you have a hosting provider?

xxamp is for local non webserver and is a completely different service.

melissa brown
melissa brown
4,670 Points

bought the student hosting account and domain name as recommended on the videos. think this is the root of some of my problems and the confusion. so im not sure how to get around this i want to use the domain name that i bought and the hosting might come in handy when the site goes live no? So how do i just develop locally because going through cyberduck is to much of a hassle each time if i cant view my code in the browser through sublime. is there a way to set up the mysql admin through xxamp. Should i maybe somehow uninstall wordpress from cpanel?

melissa brown
melissa brown
4,670 Points

thank you. im going try a few different things. just a quick question why is it that i can view the simple php code test but not the full site. just trying to understand what is different between this and the php code in the project files?

Clinton Hopgood
Clinton Hopgood
7,825 Points

I'm not sure what PHP code you're looking at, but from the information you'e given you only have wordpress installed on your web server and not on xampp.