Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

need help with php


deadsun's Avatar
Member
0 0

hey I'm just getting it the whole server side scripting thing and I'm working on a couple of websites and I'm trying to start learning PHP and SQL but in order to do that I have to have a server, so I download Apache and set up a LAMP server to start learning. The problem is I have no experience at all with Apache or PHP. So My question is how do I run php scripts? iv goggled and goggled and all it says is to put it in you're root DIR for the web site and open you browser and call the page. the problem is is I don't know how to call it from my computer because I don't know the default host name, and iv messed around in /ect/apache2 folder with the config. files but I keep getting a dead end. Any help or links is greatly appreciated. and also is "/var/www" the sites root DIR?


ynori7's Avatar
Future Emperor of Earth
0 0

I'm assuming you're using linux based on your post. On my linux box the location you put your html/php/js etc files is /var/www/htdocs. Judging by where your said you config file is, you're probably on Ubuntu, so it's probably /var/www/http.

Assuming you've got apache configured (you can easily find tutorials for that online), just open your browser and type "http://localhost" and it should display "It Works!" which is the default content of the provided index.html file. You can access other files in your document root for example by typing this url: "http://localhost/testDirectory/testFile.html". You can also say 127.0.0.1 instead of localhost if you really want to.


korg's Avatar
Admin from hell
0 0

This is clearly covered in the php help manual, Read it if you still have problems. Real cut and dry.


deadsun's Avatar
Member
0 0

Awesome thank you, I got it to work, and I did read about Apache on google I just couldn't get it to load but I see now, and just out of curiosity would anyone suggest learning ASP because I believe PHP can do the same stuff and since its not from Microsoft its probably a lot better and more compatible, but just wondering. and also people cant get access to my root DIR because i have no domain right? I don't want to be sending anything out and not know I'm doing it. and yes good job at gessing the OS I am running Ubuntu :)


spyware's Avatar
Banned
0 0

deadsun wrote: Awesome thank you, I got it to work, and I did read about Apache on google I just couldn't get it to load but I see now, and just out of curiosity would anyone suggest learning ASP because I believe PHP can do the same stuff and since its not from Microsoft its probably a lot better and more compatible, but just wondering. and also people cant get access to my root DIR because i have no domain right? I don't want to be sending anything out and not know I'm doing it. and yes good job at gessing the OS I am running Ubuntu :)

Learn PHP. ASP is a novelty at best. No one will be able to view your Apache server if you haven't forwarded to that port (80) on your router. If you have a router, that is. You can also edit some stuff in Apache to only allow (certain) computers in your network to access it.


deadsun's Avatar
Member
0 0

That's awesome I need to look into how to do that and start learning more about ports and Apache configuration. I think ill just stick with PHP and move on to SQL because .ASP doesn't sound like being worth my time when I have so much other stuff to learn. but just to make sure i understand you correctly I could connect to my sever from another computer even with out a domain? I'm guessing its something like http://myIpAdress/home.htm, or do you connect to an listing port at the IP address, assuming the configuration is set up to allow the access. also I just ran into a problem for some reason when i run my homepage through Apache it do sent bring up my background, but it dose if I just run the page though. WTF the background is stored in a file called Images and is being called by JavaScript with "Images/back.jpg" as the source. iv tried taking it out of the Images folder and just calling back.jpg as source but still no luck. any suggestions on why it wont work? all the rest works fine including the rest of the JavaScript? Sorry I'm asking so much I'm just really into this right now, its like a new world to explore.


ghost's Avatar
0 0

deadsun wrote: That's awesome I need to look into how to do that and start learning more about ports and Apache configuration. I think ill just stick with PHP and move on to SQL because .ASP doesn't sound like being worth my time when I have so much other stuff to learn. but just to make sure i understand you correctly I could connect to my sever from another computer even with out a domain? I'm guessing its something like http://myIpAdress/home.htm, or do you connect to an listing port at the IP address, assuming the configuration is set up to allow the access. also I just ran into a problem for some reason when i run my homepage through Apache it do sent bring up my background, but it dose if I just run the page though. WTF the background is stored in a file called Images and is being called by JavaScript with "Images/back.jpg" as the source. iv tried taking it out of the Images folder and just calling back.jpg as source but still no luck. any suggestions on why it wont work? all the rest works fine including the rest of the JavaScript? Sorry I'm asking so much I'm just really into this right now, its like a new world to explore.

To connect to a server without a domain, all I had to do was to log onto my DSL modem-router and set up 'port forwarding'. Basically what that is it that if the router encounters any traffic destined for a port that you specify, it forwards it to your machine. I'll save you the trouble and tell you this outright, if you do it like that, keep your machine on for longer periods because if you don't, your ISP can reassign you a different IP address for your machine after every reboot.

Regarding your other question I'd refer you to the w3schools free tutorials on HTML and PHP.


deadsun's Avatar
Member
0 0

sweet ill remember that but I don't have a router so it will be a while before I can try that, I have a laptop and my desktop is about 10 years old and wont even turn on for some reason (still working on that), but thanks for all the help, I'm just going to work on PHP for a while.


deadsun's Avatar
Member
0 0

thanks I love w3schools, the PHP part is easy, but the SQL part is a royal pain to rember lol


deadsun's Avatar
Member
0 0

cool site now I just need the time to learn all this and I'm good lol


ghost's Avatar
0 0

MoshBat wrote: [quote]deadsun wrote: thanks I love w3schools, the PHP part is easy, but the SQL part is a royal pain to rember lol So try another tutorial. http://www.tizag.com/sqlTutorial/ I think that was the one I used years ago.[/quote]

Yeah the tizag one's fantastic as well. I actually think I'd recommend that over w3schools now that I think about it. I remember they had a very helpful walk through of the $_POST and $_SESSION variables that was quite helpful at the time when I read it.


spyware's Avatar
Banned
0 0

MoshBat wrote: Personally, I cannot stand w3schools. So God-damn boring.

Interactive demo's… comprehensive reference lists… broad knowledge base…

Sorry Mosh, shit's the best newcomers guide you're going to get.


ghost's Avatar
0 0

MoshBat wrote: Personally, I cannot stand w3schools. So God-damn boring. spyware wrote:

Interactive demo's… comprehensive reference lists… broad knowledge base…

Sorry Mosh, shit's the best newcomers guide you're going to get.

MoshBat wrote: But it is boring. When you want to learn bad enough, that doesn't matter. w3schools and Tizag are interchangeable to me. They both provide a good foundation to get your feet wet but, when you want to progress beyond an introduction, you'll end up searching elsewhere online.

w3schools is also the more established resource. Tizag is a copycat, which makes it just as good, but no more.

Also, going back up a bit in the thread: If you are more inclined to VB-style syntax, then ASP is the better choice. If the C-style syntax appeals to you (C/C++, etc.), then PHP is the better choice. My preference is obviously PHP (as everyone knows) but, ultimately, the best language for you to choose is the one that has what you expect from a language.

If you don't have enough experience in programming to know which style of syntax appeals to you, then just choose PHP. Out of the two, it is going to be easier to learn and easier to progress beyond when you decide to expand.


ghost's Avatar
0 0

MoshBat wrote:

I didn't know you needed a walkthrough of those. Personally, I cannot stand w3schools. So God-damn boring.

Like most people I don't know until I learn. So of course I needed a walkthrough the first time I learned it.


ghost's Avatar
0 0

t as snide initially.