Time for Headaches
Moderator: General Moderators
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Time for Headaches
Okay, I'm ready to start bursting my head open. In my fact I haven't even started but I just know something is going to go wrong. So...
I have installed Apache Server.
I have installed SQL (I have a MySQL Command Line client and everything).
Now I want to do something crazy. I want to make a web page with a simple PHP command making connection with my test database. I know this is going to be a headache, something is going to go wrong.
Q1. How do I know if my Apache server is running correctly, it's dissapeared from my task bar and when I click on it in Start menu it says "It's all ready running".
Q2. Where do I put my web page so that it can run on the client (realspeak: on my computer without having to upload it).
Regards
Please make this simple.
I have installed Apache Server.
I have installed SQL (I have a MySQL Command Line client and everything).
Now I want to do something crazy. I want to make a web page with a simple PHP command making connection with my test database. I know this is going to be a headache, something is going to go wrong.
Q1. How do I know if my Apache server is running correctly, it's dissapeared from my task bar and when I click on it in Start menu it says "It's all ready running".
Q2. Where do I put my web page so that it can run on the client (realspeak: on my computer without having to upload it).
Regards
Please make this simple.
Re: Time for Headaches
Q1. Open your brower, type "localhost" in the address and see if Apache is running.
Q2. When installing Apache you set your root folder which is under your Apache installation if you didn't change it, called www probably. You can take a look in Apache's httpd.config and see where it is if you don't know.
Q2. When installing Apache you set your root folder which is under your Apache installation if you didn't change it, called www probably. You can take a look in Apache's httpd.config and see where it is if you don't know.
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re: Time for Headaches
Typed localhost in my Chrome web browser and it went to Google localhost, you know how you type stuff and they just show you the results from Google. So no succes there.papa wrote:Q1. Open your brower, type "localhost" in the address and see if Apache is running.
Q2. When installing Apache you set your root folder which is under your Apache installation if you didn't change it, called www probably. You can take a look in Apache's httpd.config and see where it is if you don't know.
How would I look into Apache's httpd.config? Is that even a file? Where is Apache, when I installed it I would assume I would have kept all the default settings. More clarification needed. Cheers.
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re: Time for Headaches
It works!! Haha I like it. So Open Source. Okay so I'm in Apache there's a bunch of Notepad files and folders. What do I do here? How do I make a web page simply echoing that a connection has been made between my SQL Databases and the browser? Where must I put this web page on my local computer?
Re: Time for Headaches
You might want to do some reading before starting with databases:
http://us2.php.net/manual/en/
If you have found your www folder you can either edit the index.php file or create a folder which you can work in. Then your url would be:
http://127.1.0.0/project/
A simple php test is
<?php
phpinfo();
?>
Safe file as index.php in your project folder.
http://us2.php.net/manual/en/
If you have found your www folder you can either edit the index.php file or create a folder which you can work in. Then your url would be:
http://127.1.0.0/project/
A simple php test is
<?php
phpinfo();
?>
Safe file as index.php in your project folder.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
You can't just type "localhost", you have to tell the super-bar that you're giving it an address: "http://localhost/"
The httpd.config is probably somewhere like "C:\Program Files\Apache Software Foundation\Apache2.2\conf\"
On Windows, that is.
Just do a "find" in the file for the phrase "DocumentRoot".
The httpd.config is probably somewhere like "C:\Program Files\Apache Software Foundation\Apache2.2\conf\"
On Windows, that is.
Just do a "find" in the file for the phrase "DocumentRoot".
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re:
Great, so I confirmed Apache works (tick). Now, I'm in the httpd.config file (what does the 'd' in httpd stands for I know Open Source would not make things needlessly complicated).Jonah Bron wrote:You can't just type "localhost", you have to tell the super-bar that you're giving it an address: "http://localhost/"
The httpd.config is probably somewhere like "C:\Program Files\Apache Software Foundation\Apache2.2\conf\"
On Windows, that is.
Just do a "find" in the file for the phrase "DocumentRoot".
So this document is LOOOOOONG. But it's mostly comments, so that's ok. Ok, first line of code:
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
So that means I'm going to save my files in that particular location? Ok, so I've made a folder in that directory called test_project. And I'll create a file in that folder with Dreamweaver and save it with a .php extension (don't worry I know how to do the basic things).
Then I typed in the php code suggested by papa (in the body section). Save it.
Open it in a web browser and this is what I see: nothing.
I assume it should say something like "PHP Version 3.2" etc. But there's nothing.
Cheers
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
NNNNNNNOOOOOOOOOOOO!!!!!!!!!!
DON'T TOUCH THE SERVER ROOT!
Ahem, *regains composure*
I said "DocumentRoot", not "ServerRoot". "DocumentRoot is where you will end up if you type "http://localhost/" into your browser.
DON'T TOUCH THE SERVER ROOT!
Ahem, *regains composure*
I said "DocumentRoot", not "ServerRoot". "DocumentRoot is where you will end up if you type "http://localhost/" into your browser.
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"Jonah Bron wrote:NNNNNNNOOOOOOOOOOOO!!!!!!!!!!
DON'T TOUCH THE SERVER ROOT!
Ahem, *regains composure*
I said "DocumentRoot", not "ServerRoot". "DocumentRoot is where you will end up if you type "http://localhost/" into your browser.
That's the line I found in the httpd.config file or whatever.
So I put my test_project folder in htdocs/, I will give you the code of the document here:
Code: Select all
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>So what do I do now? See, I knew this was going to be a headache before i started. I just know. It's just the way it has to be, because Apache won't say "Hey, why don't we make things easy".
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Things are easy, as long as you know what you're doing.
Are you sure the Apache service is running?
Lets make this easy: make a file called index.php, that contains the following:
Put that file into C:/Program Files/Apache Software Foundation/Apache2.2/htdocs
Type "http://localhost/index.php" in your browser.
Voila! It should work, but we'll see.
Are you sure the Apache service is running?
Lets make this easy: make a file called index.php, that contains the following:
Code: Select all
<?php
phpinfo();
?>Type "http://localhost/index.php" in your browser.
Voila! It should work, but we'll see.
-
KostaKondra
- Forum Newbie
- Posts: 16
- Joined: Thu Nov 19, 2009 8:26 am
Re:
Nope. Even worse. When I renamed the file in Windows Explorer from .html to .php it turned into an icon that said 'PHP Script' on it (like in Dreamweaver, I think it's one of Dreamweaver's icons).Jonah Bron wrote:Things are easy, as long as you know what you're doing.
Are you sure the Apache service is running?
Lets make this easy: make a file called index.php, that contains the following:Put that file into C:/Program Files/Apache Software Foundation/Apache2.2/htdocsCode: Select all
<?php phpinfo(); ?>
Type "http://localhost/index.php" in your browser.
Voila! It should work, but we'll see.
Now when I open up the http://localhost/index.php by typing that in the web browser I actually see the code!! Like everything the <head> the <body> tags everything. What am I doing wrong?
Re: Re:
You didnt install wampKostaKondra wrote:What am I doing wrong?
This will be happening because i dont think you have PHP installed.
PHP doesn't come pre-installed with apache or mysql. its another thing all together.
http://www.php.net
If you install wamp server, then it handles mysql, php and apache all in one
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: Re:
yep,Weiry wrote:If you install wamp server, then it handles mysql, php and apache all in oneKostaKondra wrote:What am I doing wrong?Not to mention, i think using WampServer is actually about 100% easier than using the command line version of the apps. But i like GUI's
get wamp http://www.wampserver.com/en/ or xampp http://www.apachefriends.org/en/xampp.html
and the majority of your problems will float away
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California