Page 1 of 1

Noobie Question - Please help me!

PostPosted: 17. November 2009 04:34
by kitra101
Hello,

I have tried numerous times both with XAMPP and attempting to install and configure PHP + mySql + apache separately. I cannot get my web browser to render php code. I am currently using XAMPP and it says that everything is installed, but when I go to localhost, it will not read php. I have tried to follow instructions for changes to be made to the httpd file and the php.ini file, but I cannot ever get it to work. At this point, I have XAMPP freshly installed and I have not made any changes since the installation. Can someone please walk me through what I need to do to make my browser able to render php code? I am really having problems with this.

Thank you in advance for any help with this matter.

-Kitra

Re: Noobie Question - Please help me!

PostPosted: 17. November 2009 12:50
by Wiedmann
I am currently using XAMPP

Which XAMPP version?

Re: Noobie Question - Please help me!

PostPosted: 17. November 2009 22:35
by kitra101
###### Apache Friends XAMPP (Basis Package) version 1.7.2 ######

+ Apache 2.2.12 (IPV6 enabled)
+ MySQL 5.1.37 (Community Server) with PBXT engine 1.0.08-rc
+ PHP 5.3.0 + PEAR (PEAR, Mail_Mime, MDB2, Zend)
+ Perl 5.10.0 (Bundle::Apache2, Bundle::Apache::ASP, Bundle::Email, Bundle::DBD::mysql, DBD::SQlite)
+ XAMPP Control Version 2.5.8 (ApacheFriends Edition)
+ XAMPP CLI Bundle 1.6
+ XAMPP Port Check 1.4
+ XAMPP Security 1.1
+ SQLite 2.8.17
+ SQLite 3.6.16
+ OpenSSL 0.9.8k
+ phpMyAdmin 3.2.0.1
+ ADOdb v5.09a
+ FPDF v1.6
+ Zend Framework 1.9 Minimal Package (via PEAR)
+ Mercury Mail Transport System v4.62
+ msmtp 1.4.17 (a sendmail compatible SMTP client)
+ FileZilla FTP Server 0.9.32
+ Webalizer 2.21-02 (with GeoIP lite)
+ Xdebug 2.0.5 for PHP
+ eAccelerator 0.9.6-rc1 for PHP
+ Ming 0.4.2 for PHP
+ PDF with pdflib lite v7.0.4p4 for PHP

Re: Noobie Question - Please help me!

PostPosted: 17. November 2009 22:59
by Wiedmann
I cannot get my web browser to render php code. I am currently using XAMPP

The XAMPP demopage is not working after installation?

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 01:33
by kitra101
When I go to localhost, I get the html page to say "it works." However, when I load the php page in the installation, it says something is wrong with the installation and does not show the php. The php, when seen in view source, shows it in pink. Additionally, when I use a simple php code on another page, such as:

<?php
echo "Hello World!"; // This will print out Hello World!
echo "<br />INVISIBLE COMMENTS"; // echo "nothing";
// echo "TEST";
# echo "TEST";
?>

It reads:

INVISIBLE COMMENTS"; // echo "nothing"; // echo "TEST"; # echo "TEST"; ?>

What do I need to do to make this work? Please someone help me -this is so frustrating!

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 02:26
by ntsmarkv
You need to make sure all your .php files and folders is located in the htdocs folder.

Think of the htdocs, the Main root folder to your server/site.

So try the following:
1). Add your .php file call it what you want we'll say test.php in the htdocs with the code you wanted.
2). Go to your browser http://localhost/test.php it should read it. If not I would add this to the top of your .php file <?php error_reporting(E_ALL); ?>

Then go to your test.php and post what errors you see.

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 02:38
by Izzy
@ kitra101

First make sure that there are the 2 XAMPP default index files in the \xampp\htdocs folder - index.html and index.php

When you go to http://localhost/ it should load the default XAMPP index.php file in the htdocs folder, which will then redirect to http://localhost/xampp/index.php

If Apache is not running then this not occur.

Check in your XAMPP Control Panel that indeed Apache and MySQL are both showing the green running indication first.

Also always check the \xampp\apache\logs\error.log file if you have server issues.

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 02:43
by kitra101
Thanks for trying to help me. In my htdocs, I now have a php file with the following code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 3.2 FINAL//EN">
<HTML>
<?php
echo "Hello World!"; // This will print out Hello World!
?>
<?php error_reporting(E_ALL); ?>
</HTML>

I then clicked your link and it says "Problem loading page, the connection has been reset."

At this point, I have installed XAMPP, but have made no corrections/configurations to php.ini or httpd.conf. Do I need to do anything to make the browser render my php code?

Thank you so much for your help - I really need it!

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 02:51
by kitra101
Wait, I started my control panel (previously it had been running from the start, but apparently was not running at this point) and it now rendered my test.php page. It showed "Hello World." There was no report from "<?php error_reporting(E_ALL); ?>"

However, when I go to http://localhost, it brings up index.html showing "it works" and not the index.php file. What is going on here?

Thanks

Re: Noobie Question - Please help me!

PostPosted: 18. November 2009 02:58
by Izzy
Make sure that index.php is in the htdocs folder and rename the index.html to index.html_orig which is being loaded and giving you the It Works message.

Type manually in your browser:
http://localhost/index.php

Let me know what you see.

Read the error.log file.

Re: Noobie Question - Please help me!

PostPosted: 28. January 2010 21:42
by robert99
Windows Vista SP2
XAMPP 1.7.3

I have a similar problem running the documentation HelloWorld example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> xmlns_"http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
</head>
<body>
<p><?php echo "Hello World"; ?></p>
</body>
</html>

I saved this file in htdoc folder as helloworld.php

but http://localhost/helloworld.php is unable to find file (or start it - as per error log)

Re: Noobie Question - Please help me!

PostPosted: 28. January 2010 22:49
by Wiedmann
I saved this file in htdoc folder as helloworld.php
but "http://localhost/helloworld.php" is unable to find file

With " unable to find file" you mean an error 404?
--> there is no file "helloworld.php" in your DocumentRoot (htdocs) folder.

Re: Noobie Question - Please help me!

PostPosted: 29. January 2010 00:57
by robert99
Wiedmann wrote:
I saved this file in htdoc folder as helloworld.php
but "http://localhost/helloworld.php" is unable to find file

With " unable to find file" you mean an error 404?
--> there is no file "helloworld.php" in your DocumentRoot (htdocs) folder.


There was a file in the htdocs folder but it was "helloworld.php.txt" (I used Notepad)
It appeared to be "helloworld.php" in Explorer.
I have taken off the .txt bit and it now works.
Thanks for pointing me in the right direction.