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

Uploading PHP

Hello,

First of all, I am really new in all of this. I have recently finished the basic course on how to create a T-Shirt website on PHP with Randy.

I modify Randy's original website to something else and see how it works. Locally I've used MAMP and everything has worked fine. But now that I have uploaded the whole project to Namecheap servers, it just doesn't work. it says:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request... (etc)

I've done the whole course but I have the feeling there's something missing. I'm a little confused. Is there an answer?

Thanks

9 Answers

My guess is that PHP is not configured on your server. Have you checked that?

It definitely sounds like a server problem. What kind of configuration have you set up?

As far as I am aware, I have not set up anything since I understood PHP is already configured on Namecheap. Would you be familiar with Namecheap?

I changed the file permission for about-us.php and it seems to work now. Also, I only got the domain 4 hours ago... that might be a problem.

About shirts4mike and .htaccess, I believe I did the whole course (at least the first one 'Build a simple PHP application') Would you know where can I find the video about .htaccess?

It is in the second course where the original site is refactored. It is one of the later videos regarding simplified urls.

Yeah, those docs look good. It also depends on which package you've gone for. I'll go out on a limb and guess shared hosting? If so, then yes PHP is very likely to already be installed.

Can you log into cPanel and view the error logs? If you hunt around the dashboard, you should find some buttons that refer to 'logs' - preferably ones that refer to server errors instead of, for instance, database errors.

I had a looked and error logs and it says constantly "file does not exist"

Well that's quite a nice error to have! Make sure your project files have successfully uploaded to the server. Also make sure they've uploaded to the right place!

This is what is says (but also about other files):

[Thu May 28 16:43:16 2015] [error] [client 85.113.119.208] File does not exist: /home/smallwor/public_html/500.shtml, referer... [Thu May 28 16:43:16 2015] [error] [client 85.113.119.208] SoftException in Application.cpp:261: File "/home/smallwor/public_html/about-us.php" is writeable by group...

Files seemed to have uploaded fine. It's also inside root.

Cool, so it sounds and looks like your files are in the right place. Can you paste in your .htaccess file?

Sure. This is what it written inside .htaccess:

<IfModule mod_suphp.c> suPHP_ConfigPath /home/smallwor/public_html </IfModule>

In your cPanel there should be a File Manager option. That will display your file tree. Do you have an index.php file at your root? That should be your home page.

Yeah, it's at public_html/index.php

I wonder if it is to do with permissions. Files are currently set up at 644 and folders at 755

Permissions would be my next guess. Have a play with the index file

chmod 775 <filename>

.. atleast I think that's it. I always forget that one!

have you got as far into the shirts4mike course to set up an htaccess file? If not no worries (that bit's coming later!)

It's weird - I see you have an about-us.php page, and I can't access 85.113.119.208/about-us.php. Unless that's just because you've set up this domain/server in the last couple of hours (it takes a while for DNS to update worldwide).

If the permissions don't fix it, can you navigate to 85.113.119.208/about-us.php and check the associated error in the logs?

I would call technical support. I had an issue with a Joomla site that they fixed in 30 seconds. The wrong PHP version was in use for my particular site. It was a configuration issue that they could fix quickly.

I use Justhost for my hosting and customer service there has been fantastic. I would not hesitate to give them a call. It has saved me hours.

I just logged into my cPanel. The first category, software/services, has a PHP Config option. There are a number of options with recommendations. I think contacting customer service to explain it to you is a wise option. That is what I will do if I have problems deploying my first PHP site, which may be today. (Other than Joomla based sites)

But where's the fun in calling support straight away! :p

I am running out of ideas and can't find much luck with google. I may eat my words, but it doesn't sound like a php version at all - at least the error message doesn't suggest this. They advertise php 5.2 - 5.6. The Shirts4Mike project should sit within this bracket and shared hosting should be as good as plug and play.

Ah but I think i've misread the error. It looks more like it's throwing out a 500 (internal server error type) and it's complaining it can't find a 500.shtml page to say "HEY! I had an error".

I changed the file permission for about-us.php and it seems to work now. Also, I only got the domain 4 hours ago... that might be a problem.

About shirts4mike and .htaccess, I believe I did the whole course (at least the first one 'Build a simple PHP application') Would you know where can I find the video about .htaccess?

I also wonder what that 500.shtml is... there is no file named like that :S

Awesome! I'm glad that fixed it. I would just have a little search around the internet to make sure you're happy with that permission setting. For a small project like this, you should be okay :-)

Some servers (shared hosting) will default to 40* and 50* pages when it encounters the appropriate error. Because it hit a 500 internal error, it tried to find a page to display to the user. If you want, you could create a custom page and call it 500.shtml, and it should be displayed when the server has a 500 error. What's really annoying.. It logged that it couldn't find the error page but not the actual error itself. I mean.. What!

I believe both of the following courses extend the shirts4mike app:

Enhancing a simple php application

and

Using php with mysql

I'm glad the file permissions worked!

Thank you so much Tom Cawthorn!

No worries! It was Ted Sumner who spotted the file permissions ;) Sweet as.