i want to know to run php we use localhost as a server....can we use any other server??????or php is server side scripting language thats why we use localhost....but want to know can we use any other server??
Well, PHP is a server side scripting language and it is easy to use localhost if you are working on the server. But nothing will prevent you from using a fully qualified domain name to connect.
The only thing with using "http://www.yourdomain.com/what-you-made.php" is that your local server must understand it. That means you must have a correctly configured Apache or Microsoft web-server running.
And as almost any server where PHP is installed understands "localhost/what-you-made.php" that's why we use it to test out stuff.
Apache is acting as a server to execute your php files from your system.
I think you aware of XAMPP, WAMP, Moodle, LAMP... These are the packages which contains the server to execute our script which is the resemblence of the real server. This is just for testing our files and should help you to debugging your files before you load your site into hosting server. Bcoz everybody not having their own servers, so before upload into your hosting server, you come to know the result what would be there when you completed and upload your files on the real server.
In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface. The name is also a reserved domain name (cf. .localhost), set aside to avoid confusion with the narrower definition as a hostname.It is Communicating with the loopback interface in an identical manner as with another computer on the network, but bypassing the local network interface hardware, is useful for the purposes of testing software.so we are using this.Connecting to locally hosted network services, such as a computer game server, or for other inter-process communications, can be performed through loopback addresses in a highly efficient manner.
Local hosts are we use for some spacific placeses. Localhost is specified where one would otherwise use the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site, provided the server is configured to service the loopback interface.Communicating with the loopback interface in an identical manner as with another computer on the network, but bypassing the local network interface hardware, is useful for the purposes of testing software.so it is using for these places.