Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to learn PHP, and it's getting annoying having to upload a file to the server every 30 seconds. Is there a way to get a browser (I use Chrome on Mac 10.6.7) to interpret a PHP file (browser plugin or external app)? Or, is there some way to "convert" the PHP to HTML, with all the "hypertext preprocessing" done?

In short, is there a way I can practice PHP without using a server, or installing a server on my computer?

share|improve this question
I find the easiest way is to log in on your server and edit the PHP files locally. That way you do not have to upload. – Hennes Jan 8 '13 at 18:55
How would I do that? I've been using FTP, and it's astoundingly slow. – tkbx Jan 8 '13 at 18:57
1) FTP is ancient. Not quite the same age as horse and cariagge, but really, avoid it. 2) Teh say I do it is by SSH-ing into the server and then editing the webpage/php files locally with vim (a texteditor). Depending on your OS remete desktop or VNC are alternatives to ssh'ing to a shell). – Hennes Jan 8 '13 at 18:59
@tkbx if you install a server on your home computer you won't have to deal with FTP or uploading at all. At that point it is just a drag and drop on the local filesystem. – Moses Jan 8 '13 at 19:31
@Moses I don't have root access to my machine, and I have a hosting package that I use for various things. php command will work for now. I've got a Linux install with LAMP as well, but it's being used for something else. – tkbx Jan 8 '13 at 21:11
up vote 4 down vote accepted

Not really no, "PHP is an open source server-side scripting language designed for Web development to produce dynamic Web pages". You could just set up a local server and test there, that is what I do.

Alternatively, on Linux at least, you can run PHP scripts from the command line:

$ php index.php > output.html

You can then open the resulting html in a web browser.

share|improve this answer
This also works on OS X since, for example Mountain Lion, ships with PHP 5.3.15. Or If the OP wants to install a server nonetheless, MAMP would be a good solution since it's rather isolated from the OS and can be removed easily. – slhck Jan 8 '13 at 18:58
I've got Snow Leopard, and I've got php. This is exactly what I'm looking for, thanks! – tkbx Jan 8 '13 at 18:59
You can run php from the command line under windows as well, just saying – ArtisiticPhoenix Apr 10 '15 at 20:09
@ArtisiticPhoenix I never said you couldn't. I just said you could on Linux which is the OS I use. I'm sure other OSs can also do it but I don't know the syntax or anything about it so I didn't mention them. – terdon Apr 10 '15 at 22:29

Just install MAMP, you can run php local on your computer.

share|improve this answer
I've tried various AMP stacks for Mac, and they all need root/admin, which I don't have. I'll try that one, but the php program has worked well so far (other than GET and POST.) – tkbx Jan 12 '13 at 3:08
have you tried Uniserver you can run it on a flash drive, full Apache php mysql – ArtisiticPhoenix Apr 10 '15 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .