问题描述:

With HTML files, I can work locally and preview the files in my browser after I've saved and made changes (and use LiveReload), but with PHP the browser just loads the code. Do I need to run a local server to work on it locally, or is there an easier way?

The extent of my PHP is using include statements for headers and footers.

网友答案:

Yes you will need a local server to run PHP scripts locally. Check out MAMP for Mac or XAMPP for PC.

网友答案:

Yes, you'll need to install something such as WAMP

网友答案:

No - since php is a serverside interpreted language you have to run a server. The easiest way is to install xampp whick brings everything you need - apache, mysql, php.

On windows you could also install IIS server which is part of windows

网友答案:

You can very easily download and set up a server - and on that note, yes do do need to have PHP and Apache set up to have PHP working.

I would probably suggest something like WAMP - it is basically pre-setup and requires very little config to get up and running. This will come with Apache Server, MySQL and PHP set up nicely to work together and comes with a very easy to use point and click interface. Oh, and it even installs PHPMyAdmin so that you can easily work with your databases if you are not familiar with console controls.

网友答案:

You need to set up a server that can serve php requests appropriately. However, this is incredibly easy to do. Just google how to install a LAMP server (on Linux), or look into WAMP (on windows). If this is still too much for you, look into purchasing a shared hosting account or something. I have a small one for like $15 a year. They will have the servers set up with everything you need already; you'll just have to upload the files.

网友答案:

Yes, you need to run a local server to 'work with it'. I would suggest XAMPP. To actually edit the files, you of course need a text editor. Any editor will do as far as I'm aware, but I use Notepad++ myself, or even the NetBeans IDE.

相关阅读:
Top