Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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

2 Answers 2

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
1  
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

Just install MAMP, you can run php local on your computer. http://www.mamp.info/en/index.html

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.