Jump to content

Writing PHP


kazali

Recommended Posts

Hi

 

I am brand new to PHP but need it for forms I'm planning on using in a new website. So I've been reading some tutorials and testing some php script.

 

However, unlike when you add the .html extension when using notepad to write html code, all I get is a notepad icon instead of the IE icon and when I open it with IE or Firefox all I get is a page of html coding.

 

Which software should I be using to write the code?

 

Karen

Link to comment
Share on other sites

Hi

 

I am brand new to PHP but need it for forms I'm planning on using in a new website. So I've been reading some tutorials and testing some php script.

 

However, unlike when you add the .html extension when using notepad to write html code, all I get is a notepad icon instead of the IE icon and when I open it with IE or Firefox all I get is a page of html coding.

 

Which software should I be using to write the code?

 

Karen

This is because php scripts are not the same as HTML. HTML is a client side language. Your browser will only understand client side languages. Client side languages are HTML, CSS and Javascript and few others. PHP on the other hand is not a client side language it is known as a server side language. This is why when you open your php file in a browser all you'll see is either a blank screen or your php code.

 

In order to run your PHP scripts they will need to be in a server environment. This doesn't mean you'll need web hosting. You can run your PHP scripts off of your PC. In order to so you will need to install a couple of things. A http server the most popular being Apache and PHP itself. You will need to configure Apache with PHP. The best place to know how to configure Apache with PHP is php.net. As for how to use Apache go to httpd.apache.org

 

Installing Apache and PHP can be quite hard for the first time, however installing them this way gives you a better understanding of how Apache and PHP work. If you do not want to try a manual install then you can go for a pre-packaged AMP setup. There are many available however I recommend WAMP

 

If you go for WAMP please read WAMP documentation for where to place your scripts. If you go for a manual install of Apache and PHP then you need to place your scripts in Apaches DocumentRoot, default is something like C:/Program Files/Apache Foundation/Apache2/htdocs. In order to run your scripts you must open a web browser and then go to http://localhost/

Link to comment
Share on other sites

Hey, I remember this utter confusion once upon a time too  ;D

 

I ended up finding some nice helper WAMP applications from http://www.codango.com/...though looking at it again I cant recall which...lol, how sad is that?

 

Anyway, check it out on the site and see if one of the automated installers gets you on track :)

 

Good luck!

 

http://codango.com/php/dir/software/install/windows/

Link to comment
Share on other sites

IMO, the best way to go is to use linux. my favorite distro is openSUSE. Installing apache, php and mysql took me all of twenty minutes on this machine! :) plus if i ever need to host files on the interwebs, linux is more stable than windows. plus it's the standard!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.