D
D
DartNyan2015-01-31 23:10:21
Python
DartNyan, 2015-01-31 23:10:21

PHP needs a lock. server, but for other PLs?

Greetings.
I'm just learning and therefore my question will seem silly to you.
It's about server languages.
PHP needs a local server. For example, a bunch of LAMP.
And in runet a huge number of articles on this topic.
And what about other languages? Are similar local servers being used or is there no need for them?
I would be grateful for a detailed answer or a link to the relevant article.
Thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
N
naXa!, 2015-02-01
@DartNyan

The most stupid question is the one that is not asked.
Local server is a special program that allows web developers to develop a site on a local (home) computer, without the need to access the Internet.
The need for such a program arises precisely when developing dynamic sites, i.e. sites that use php (or perl, node.js, etc.) in their work - scripts. You don't need a local server to test regular html+css sites.
Here, in my opinion, it is important to understand that some things the browser is able to do (parse the html page, execute js code, ...), and they are performed on the client side, and some things* are performed on the server side. In response to a request, the server, based on a script / program, generates a page that it sends to the client. This is the essence of the server. This will be the difference: (once again) if you use only languages ​​in the project that the browser "understands", you can do without a local server.
The languages ​​you mentioned in the tags require local servers:
Java ** - Tomcat , JBoss AS , GlassFish , Jetty etc.
Python *** - Google App Engine, web servers that implement WSGI , ( Twisted Web , for example) etc.
JavaScript *** - Node.js (based on V8) and others
Ruby on Rails *** - WEBrick , Mongrel , any web server that supports FastCGI , ...
__________
* To implement sites with dynamic content, either for security reasons or to take the computational load off the client, ...
** The server is needed for servlets; java applets run in the browser, without the participation of the server.
*** Important: I'm not sure about these languages ​​and the framework, I just did a quick google. I hope a knowledgeable person will not pass by this answer and correct me if something is wrong.

P
Pavel, 2015-01-31
@ProgramCodePav

Server languages ​​have a feature - processing only on the server. It depends on the software. What happens when you visit a page with PHP (or other language) code:
1. Your browser sends a request for an html page (file) to %url%;
2. The server receives your request, takes the requested page (let's say index.php with html + php or just php code), processes operations with the php language (like a normal program);
3. After processing PHP commands on the server, the output is an html page (the content, of course, depends on what was written in the code - it may be empty)
4. The server sends you this page
5. Your browser receives it and opens
upd: that's why you can't do without a server. And it's local or dedicated - it doesn't matter, the trick is in the software

V
Viktor Vsk, 2015-02-01
@viktorvsk

The server is required. LAMP - no.
In php there is php -S localhost:3000 , it seems to be a built-in web server
In all other languages ​​(ruby, python, for example), with minimal gestures - too.
You can always use sqlite as a database - just a file.
Here, I think, references are superfluous. Unless:
php.net/manual/en/features.commandline.webserver.php
Well, and for the future it's good to understand that the common nature of php is different from others. php is born and dies when requested, while other languages ​​are used to loading the environment and working with it (in the general case). As a result, you will see that a PHP application in production can take 5 megabytes, and in ruby ​​- 200.

I
index0h, 2015-02-01
@index0h

As of 5.4, php has a built-in server, but it should only be used for testing purposes. PHP - does not store its state from request to request, it was originally created that way, as a result - for some cases - this is its killer feature, for the other part - a disadvantage. For example: in one of 200 php files there is a syntax error, all requests that will NOT require this file will work, the rest will be fatal. I do not argue, for this it is necessary to beat with a fucking broom in one place, but situations are different.
NodeJS / Ruby / Golang / Erlang / ... servers come up with their own, and they have some kind of state stored between requests. You need to be careful in terms of catching errors, since any uncaught exception will disable your server (for this you need the same broom in the same place))).
For these languages, nginx usually also rises and gives static, and requests for html are already proxies.

E
Eugene Burmakin, 2015-02-01
@Freika

Ruby on Rails has a built-in WEBrick server, which is launched for a specific application from its directory with the command rails server. The application will be available in the browser at localhost:3000

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question