I'm quiet confused as to how PHP works. Just starting out and want to learn it but all I have done prior to now is C++ and Javascript. I'm not sure where to start.

I have tutorials on PHP, no problem there.
I'm not sure whether it is compiled, interpreted by a web browser or uploaded to a server and compiled there? Can you download PHP and install it in an IDE to make it work? (told you I am confused).

Then there's this concept called Apache. I believe it's a server where I upload my PHP file to and it interprets it and spits out the web page I created with PHP. Is that right? Does it work like Javascript?

Would someone be able to explain this to me..

Thank you very much.

Recommended Answers

All 6 Replies

For local development you can install a package like WAMP or XAMPP. It installs Apache, PHP and MySQL. Apache (web server) has modules to run PHP scripts. PHP itself is an executable which you can run separately if needed.

Javascript run client side, inside a browser, PHP runs server side.

This explanation is a few years old but th basics haven't changed:
Click Here

There are many packaged Lamp stacks that you can install on your local PC to use for development and testing. This provides a list of the ones you can use for a Windows environment:
Click Here

Thanks both, I'm still a little confused. I managed to find some good explanations on this link too.

Click Here
My confusion lies in this fact that I have never understood the idea of Running code on the Server Side. Anything I've ever done has been Client side and that's been my limit.

So you're saying, at least I think this is what you're telling me, is that once I create my code I upload it to a server and it spits out the result in the form of an interactive webpage for example.

Pritaeas, you've said that WAMP or XAMPP could be installed to run PHP locally? Or is this just a conduit to get to Apache web Server? Is there a way to build stand-alone programs with PHP, meaning, can I compile it into an EXE file (I think thats what you've said above). Sorry for all the questions.

Thanks so much.

If you understand how an interpreted language works, that's what it does whether it's a local test environment or on the server. The interpreter takes each line of code in your (PHP) program, parses it and then acts on the action words and data elements in that line.

Most of the servers are running a version of Linux/Unix but you don't need to know a lot about Linux in order to set up a site on a linux server and run your code. The same applies to running a local test environment. You do the install, you put your code into the designated directory within that environment and then you run the start procedure for the package. When you do this, you will actually have a local standalone version of the LAMP stack (Linux, Apache, MySQL and PHP).

PHP is generally run from the original source but there are some options to create "byte-code" and run from that instead. This isn't compiled code, it is a half-way measure. It does provide some protection for your code if you are selling it. Zend and IonCube both sell facilities that do this. IonCube also provides an online pay-as-you-go version as well.

basicly php tells your webserver how to create a html-page that gets sent to the browser

Thanks everyone. Its all new to me. Uploading to a servier is somethign I'm very vague on but what this does tell me is that I had probably better stick to Javascript for the things I need to do.

PHP seems to be for an entirely different approach and purpose.

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.