NEWBIE: Using XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

NEWBIE: Using XAMPP

Postby amber » 04. December 2010 10:43

Happy Holidays everyone! :)

Just installed XAMPP for Windows a few days ago, and when I type http://localhost on the browser, welcome screen says I have installed XAMPP successfully - there, so i guess XAMPP is working properly now.

Now, my problem is that when I put a copy of my live website's folder under XAMPP folder's "htdocs", and then type http://localhost/site/index.php, the screen shows 404 error message: "Object Not found!" It goes the same with any other URLS i typed that is from the XAMPP htdocs folder.

Help?

Additional Notes -
- I already moved the original old XAMPP files from the htdocs folder to my desktop. (These files are the one that shows the welcome message after successfully installing XAMPP).
- I made sure correct spellings were being typed.
- Website is working fine live, by the way. I'd like to use XAMPP to test my site when working on it offline - i.e. when I modify something, etc.
- Nope, I'm not a website designer. I just wanted to learn how to at least have the flexibility to be able to modify or made simple changes in my site when needed. - i.e. wrong spelling, correction of sentences, etc. Nothing complicated changes, at least for now.
- Appreciate it if we use layman's terms on the replies, please? :)

PS: If by chance this kind of problem has already been solved, making this thread a redundant, i apologize for the inconvenience caused and appreciate it if you can direct me to that thread. Thanks!
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby JonB » 05. December 2010 04:25

I hope the folder name under htdocs really is 'site'

\xampp\htdocs\site\index.php

Did the folder contain a .htaccess file???

:?:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: NEWBIE: Using XAMPP

Postby amber » 05. December 2010 14:18

Hi there JonB, :)
JonB wrote:I hope the folder name under htdocs really is 'site'

\xampp\htdocs\site\index.php:?:


Yes, the folder's name under htdocs is "site".

JonB wrote:Did the folder contain a .htaccess file??? :?:


No, there is no .htaccess file under the (XAMPP) folder. While, on my host file manager folder "public_html", i did see there is a .htaccess file - in case this matter.
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby JonB » 05. December 2010 18:19

Amber:

you should be checking in the 'site' folder for a .htaccess file

Also, its possible that your index.php file is a redirector or uses includes - both of which could cause instant "404's" when they point to things that don't exist on your server.

You should do a couple things:

Make a static .html page and place it in your 'site folder' - if you can access it - then the server isn't crazy. I hope you DIDN'T move the \xammp\htdocs\xampp folder - as it helps you debug stuff. If you did, put it back, and go to http://localhost/xampp/index.php - if that page works - PHP is working correctly.

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: NEWBIE: Using XAMPP

Postby amber » 08. December 2010 10:15

Hi JonB,

1. Yep, when I put the "old" xampp folder back, it's original XAMPP index page works/loads well.

2. I made a test page with the following, and it also worked -
<?php
echo "testing PHP...";
?>


Sigh.. :( Still don't know what to do to make the "site" files load in my browser offline using XAMPP.
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby Nobbie » 08. December 2010 10:20

Did you look into the error_log? (No, of course not....!). It tells you by far more precisely what is going wrong.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: NEWBIE: Using XAMPP

Postby amber » 09. December 2010 16:23

Nobbie wrote:Did you look into the error_log? (No, of course not....!). It tells you by far more precisely what is going wrong.


Hi there Nobbie :) Yep, attempted to check, (by typing "apache\logs\error.log" without quote in the browser, correct?) However, page says " Oops! Google Chrome could not find apache"?!!

Don't know what I'm doing wrong.
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby JonB » 09. December 2010 16:56

you have to open error logs with a text editor, like Notepad.

:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: NEWBIE: Using XAMPP

Postby amber » 09. December 2010 17:20

whee! now I can load "site" index.php on my browser - by typing "localhost/site/index.php" - My site's header, footer, and navigating tabs showed properly. However, in the page body, it says -

"Page not found.

We're sorry, the page you were looking for wasn't available

The link you followed wasn't written properly or there was a typo in the adress you entered in your browser. We are sorry for the inconvenience."

Now, what did I do wrong? I think I'm close to making it work, help?
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby JonB » 10. December 2010 00:45

well, we area at a loss here - as we don't know either the file name you gave to the 'body page' OR the HTML/PHP that might have been written to include it.

:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: NEWBIE: Using XAMPP

Postby amber » 10. December 2010 11:49

Hi JonB, thanks for being there with me all this time. :) I mean from my very first post, till the very updated one. Really appreciate the replies.

JonB wrote:you have to open error logs with a text editor, like Notepad.

:shock:


Hmm.. how exactly should i do this again? I mean, where I should find the error logs first before opening that file with a text editor?

JonB wrote:well, we area at a loss here - as we don't know either the file name you gave to the 'body page' OR the HTML/PHP that might have been written to include it.

:shock:


Gosh! Couldn't explain more. :oops:

Here, maybe this will help a bit (or not) - What I did was that I just "copied/download/transferred" (whatever the right term is) via FTP the entire "public http" folder from my Host cpanel (in which I named "SITE" folder in my computer), and then I put a copy of this "SITE" folder into the XAMPP htdocs folder. I didn't amend or edit anything from the folder. I thought XAMPP will work the same as my host, only difference is I can work/test the website pages (php) offline.

I just want to edit (and also learn) to do some minor changes with the pages of site - simple things like spellings or sentence/paragraph addition.

By the way, just to note, the live website is ok, no missing pages or anything like that. - if this info matter.
amber
 
Posts: 6
Joined: 04. December 2010 09:45

Re: NEWBIE: Using XAMPP

Postby xfsgpr » 12. December 2010 00:13

Have you made the two folders (htdocs & tmp) as shared? The temp folder is at this location on WindowsXP:

[url]C:\xampp\tmp[/url]

The htdocs folder is at this location:

[url]C:\xampp\htdocs[/url]

The tmp folder is used by PhP to create temporary files.

hth
xfsgpr
 
Posts: 27
Joined: 20. August 2009 21:45

Re: NEWBIE: Using XAMPP

Postby Sharley » 12. December 2010 01:06

amber wrote:What I did was that I just "copied/download/transferred" (whatever the right term is) via FTP the entire "public http" folder from my Host cpanel (in which I named "SITE" folder in my computer), and then I put a copy of this "SITE" folder into the XAMPP htdocs folder. I didn't amend or edit anything from the folder.
In light of what you wrote above then I believe your issues are with relative paths in your file's html or php code.

For example (public_http and public_html are the same for this example):
/somefile.php on your online hosted server would be found in public_html/somefile.php
/somefile.php on XAMPP server would be found in htdocs/somefile.php

So in your case all the relative paths that point to /somefile.php need to be changed to simply somefile.php that reside in the htdocs/site folder - drop the leading slash.

In XAMPP the DocumentRoot is htdocs
Your files are in htdocs/site
So the relative path for your files in htdocs/site/ would be simply somefile.php or somefolder/somefile.php
http://localhost/site/somefile.php
http://localhost/site/somefolder/somefile.php

Clear as mud but you need to adjust your paths to take into account your move to htdocs/site/somefile.php in XAMPP, as in your online server they are in public_html/somefile.php

Your XAMPP server is looking for /somefile.php in the htdocs folder - htdocs/somefile.php - so you will always get the 404 'file not found' error until you fix the paths and the Apache server's error.log file will confirm this - put simply...
public_html/somefile.php = http://yourwebsite.com/somefile.php
htdocs/somefile.php = http://localhost/somefile.php

You can create an exact mirror of your online site by simply downloading all the files from your public_html folder and putting then in the htdocs folder of XAMPP.
(Delete the 2 index files already in there - index.php and index.html - which are not needed for this exercise to work, you will be using your own site's index files).

Then your relative paths and your web site will work in XAMPP with hopefully no more 404 'file not found' errors in your browser or in the error.log file.

Or you can create an exact mirror of your online hosted web site by creating a VirtualHost in XAMPP - searching as much as possible and reading about this subject will be worth the effort - too much detail for me to include in this topic.

So in summary I have given you 3 methods to fix your relative path issues:
1. Correct all the relative paths to reflect the site's files are now using the htdocs/site folder
2. Move the files out of the htdocs/site folder and into the htdocs folder.
3. Create a VirtualHost.


BTW the log files are always stored in "C:\xampp\apache\logs\" folder by defaults and you need to drag them into your text editor to read them or associate the .log file extension with your text editor to allow you to double click on the log files to open in your text editor.

Good luck and if you know how, then you can use your text editor to find and replace your errant relative paths or change them all to absolute paths - Google for help on these path references if your not familiar with the terminology.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 173 guests