1

I am studying on YouTube HTML5 forms with PHP files; the videos either start with a web page containing the form and link to a PHP file or they put everything in php files; I copy the instructors exact files; but they do not work: nothing is posted after filling the form and hitting the submit button.

I have had the files on a USB flash drive then tried them actually on the computer: nothing.

My question is then: "Do I need to have an actual server on my computer in order for PHP files to function?"

2
  • 2
    Yes, you shall have a PHP server (apache, nginx, ISS, etc..). Commented Apr 28, 2017 at 17:02
  • Yes, you need web server to run the php script. Because php is server side scripting language. Install lampp or wamp server in your local machine to run php scripts. HTML and CSS is client side scripting. So both can be run without servers Commented Apr 28, 2017 at 17:05

3 Answers 3

1

Yes. PHP requires a web server to run on.

You can run it on your own computer; the web server doesn't have to be connected to the internet while you are creating and testing your PHP scripts off your local machine. You can read more about this on the official PHP What do I need page

You can download one of the following local servers:

Here is a good explanation of Why a web server is required to run PHP. Basically it is because PHP is a dynamic server-side scripting language.

However if you just want to run simple PHP scripts, with no web pages. This is possible without a web server running. See this question: How can I run a php without a web server?

Sign up to request clarification or add additional context in comments.

1 Comment

all I would add to this is use XAMPP, not WAMP, you'll thank me later :)
0

Yes, PHP will need to run on a server in order to execute. If you have a Mac, it should be equipped to run an Apache server. I found this article to be really helpful when developing with PHP - https://jason.pureconcepts.net/2015/10/install-apache-php-mysql-mac-os-x-el-capitan/

Comments

0

Yes. PHP files contain code that must be handled by an interpreter, that is, a program that reads the PHP code and outputs accordingly. This can be done without a webserver (using command line php) but PHP is most commonly used with a web server.

You want to setup some sort of stack with a web server and php. A lot of beginners use apache as a web server, and since you are comfortable using youtube for learning, a simple search for "apache php" and your operating system.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.