Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache, Mysql, Php - Newbie

Status
Not open for further replies.

itspooch

Technical User
Nov 29, 2003
5
GB
Hi, I am trying to learn Php & Mysql. I am not very technical and have only really played around with HTML before.

I bought a book to try and learn, the books tells me to install Apache,Mysql and PHP in that order which I have done (Win XP Pro).

the book then tells me to create a little test script in PHP and point my browser at it?? it doesnt tell me where or how I can point my browser at it where do I store this file as I dont have webspace setup on my PC's hardrive so what is she on about. Normally I would post it into a hosting package with my FTp software and view it on the web or just in the browser with html.

I have looked at Apches website and mysql and they may as well be written in spanish I dont know where to start and I am so peed off with it I feel like dropping my PC out of the top window !!!

Please somebody point me in the right direction !!!!!!!
 
Don't worry it is always the obvious things that aren't obvious that they leave out of the books.

Best to start with if apache is working from your browser IE or whatever you have try
this should bring up a default page talking about Apache which is probably physically located at somewhere like
C:\Program Files\Apache Group\Apache\htdocs

Try sticking your own mypage.html in this directory and see if you get to it with
Next test to see if mysql is working - open up a dos window (can you still do this with XP ??) navigate to c:\mysql\bin or wherever you installed mysql and try

mysql -u root -p

This should get you into mysql if you have done a straight install. Best practice is to set the root password create a new database and set up a user for php to use giving them rights to this new database.

mysql>use mysql;
mysql>update user set password=PASSWORD('rootpass');
mysql>create database mywebdb;
mysql>grant all on mywebdb.* to webuser@localhost identified by 'webpass';
mysql>flush privileges;
mysql>exit;

Test that this new user webuser can get into mysql and create a table to look at

mysql -u webuser -p
Password: *******

mysql>use mywebdb;
mysql>create table mytesttable (f1 char(4), f2 int(8));
mysql>exit;

Next you need a simple php script to test that you can get to the database call it something like testphp.php and stick it in C:\Program Files\Apache Group\Apache\htdocs and test it with
<?php
$connection = mysql_connect(localhost, webuser , webpass) or die (&quot;Unable to connect!&quot;);
$query = &quot;desc mywebdb.mytesttable&quot;;
$result = mysql_query($query, $connection) or die (&quot;Error in query: $query. &quot; . mysql_error());
while ($query_data = mysql_fetch_array($result))
{
foreach ($result as $txt)
{
print &quot;$txt \t&quot;;
}
print &quot;<BR>&quot;;
}
?>

Damn just written all this only to find that you probably want something like this

 
hvass !


I really appreciate your help with this !!!

I can now see the documents in the localhost area now. Thanks. Kinda weird thing though !

I can open the dos prompt in XP and can see the folder path to where mysql is stored but cannot open it in dos. It tells me the system cannot find the path specified ?? so I cannot even get to mysql ???
 
hvass !

No problem............thanks for your help !!

Much appreciated


Pooch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top