Skip to content

Web server and PHP

🖵 slides

Web server and PHP

bg opacity:0.2

What methods did we used to run web pages on our browser ?

  • Simply open a file on the browser
  • Github pages
  • Built-in web server in PHP
    php -S localhost:8080

Live server

Launch a local development server with live reload feature for static & dynamic pages.

Live server

bg right

What is a web server ?

A web server is a computer that have:

  • a software that can answer to HTTP requests (HTTP server) and ;
  • files to be displayed.

Problems with the built-in web server ?

  • Only for development
  • Too much logs
  • No security
  • Bad efficiency

bg right

What are the alternative ?

  • Apache
    • LAMP (Linux, Apache, MySQL, PHP)
    • XAMP (MySQL+PHP+PHPMyAdmin)
  • Nginx

Is it easy to use ?

You can install XAMPP! on your computer, but if you work with a team or lose your computer you have to install all of it.

What can be the solution ?

bg right


La containerisation c'est bien.

Vincent Guidoux, everyday.

Xampp container

docker run --name myXampp -p 41061:22 -p 41062:80 -d -v /www:/www tomsik68/xampp:8

Xampp container

1
2
3
4
5
6
7
8
9
services:
  myXampp:
    image: tomsik68/xampp:8
    container_name: myXampp
    ports:
      - 41061:22
      - 41062:80
    volumes:
      - ./www:/www

What should I remember?

  • What is a web server
  • Why I should not use the built-in web server in PHP

Can I still use the built-in web server in PHP ?

Yes, but only for development.

And yes, you can use it for the practical work 2, just be sure to document it in the README.md.

Sources