Total noob here trying to learn PHP. I installed XAMPP for windows following that link. And I installed it. I pulled up the control panel and I had no idea what anything was. So I just stopped Mysql from the CP and exited. Can someone tell me how can I start using php on my comp?
20 replies to this topic
#1
Posted 27 January 2011 - 11:57 AM
|
|
|
#2
Posted 27 January 2011 - 01:13 PM
In the xampp directory, you will find a directory named htdocs. in that directory, or even better, in subdirectories to it, you place your .php files.
then you try them by browsing to http://localhost/sub...tory/myfile.php or whatever you name your directories or files...
then you try them by browsing to http://localhost/sub...tory/myfile.php or whatever you name your directories or files...
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 27 January 2011 - 03:20 PM
thanks, I understand now.
#4
Posted 29 January 2011 - 10:22 PM
Here is what you should do:
Open the control panel,
Start Apache,
Start MySQL (if you want to use databases),
Find your htdocs folder and clear it out,
Put all your PHP files in there (I recommend getting Notepad++ for writing PHP),
You can access your server from the same computer on "http://localhost/" you can also use PHPMyAdmin (A handy GUI tool for creating/managing/deleting MySQL databases, accounts and tables) at "http://localhost/phpmyadmin/".
Enjoy PHP!!
Open the control panel,
Start Apache,
Start MySQL (if you want to use databases),
Find your htdocs folder and clear it out,
Put all your PHP files in there (I recommend getting Notepad++ for writing PHP),
You can access your server from the same computer on "http://localhost/" you can also use PHPMyAdmin (A handy GUI tool for creating/managing/deleting MySQL databases, accounts and tables) at "http://localhost/phpmyadmin/".
Enjoy PHP!!
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).
#5
Posted 29 January 2011 - 11:56 PM
I totally disagree on "clearing out your htdocs"!! There are settings you can do from these files which is good for a beginner. it's a lot better to create your own subdirectory!
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#6
Posted 30 January 2011 - 12:29 AM
Note that I am totally agree with Orjan, i.e. to use your own subdirectory instead of clearing out the default htdocs content. However that step actually is not dangerous. Yes, you would loose some sample page/script, but i think it will be fun to do it in order to learn a bit the basics of how apache works (like which one it prefer, index.html, index.php, or index.htm? things like that). And since XAMPP makes the installation very very easy, you don't have to worry to much in case you do break something. Just uninstall everything and reinstall.
#7
Posted 30 January 2011 - 09:39 AM
Putting the HTDOCS files and folders somewhere you can retrieve it when you need it will be a better Idea, or you can learn creating your own virtual hosts. :) Anyway, that's too far from learning PHP, but it can be a good start creating your own vitual hosts so you can have a different folder to play with.
#8
Posted 30 January 2011 - 09:46 AM
About your question, i forgot.. put your php files in here "%XAMPP FOLDER LOCATION%"/htdocs the default ussually is "C:\xampp\htdocs" you'll find preinstalled files there you can just cut it the put it on a different folder if you like, then on the HTDOCS folder, create a file called "index.php" ,without the quotes of course. Then, open it using notepad, then type this code..
then save :)
go to your web browser, then on the address box, type "http://localhost/" or "http://127.0.0.1/"
you should see
"HELLO WORLD"
<?php //open tag that denote a php script will be executed echo "HELLO WORLD"; // THIS WILL OUTPUT HELLO WORLD IN YOUR BROWSER ?> // ending tag to denote the php script had just been ended
then save :)
go to your web browser, then on the address box, type "http://localhost/" or "http://127.0.0.1/"
you should see
"HELLO WORLD"
#9
Posted 30 January 2011 - 02:37 PM
I have the xamp folder in my downloads. Can I/Should I move it to my C drive? Also, I have 3 folders in htdocs: forbidden, restricted, xampp and a bunch of image files
#10
Posted 30 January 2011 - 02:54 PM
Your setup should be fine, feel free to clear your htdocs folder completely and write your scripts in there (i.e. htdocs/index.php) to get started.
Then you can browse it through http://localhost/index.php
Then you can browse it through http://localhost/index.php
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#11
Posted 30 January 2011 - 04:06 PM
Do you mean delete the three folders, or just clean whats in them? Also, can I start writing php by just saving from notepad file.php into htdocs folder and then using my browser to that address? One more thing, if you guys know any good tutorials for very basics for starting php, link them to me plz.
#12
Posted 30 January 2011 - 04:28 PM
Also, what's the relationship with php and mysql. And is xampp just a package for these different programming languages like java sdk is for java?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









