Greetings to all! Just getting to know PHP. From the very beginning there were a lot of problems. PHP does not have a pre-installed local server. In this regard, many problems have arisen.

Could not install LAMP. on manuals:
http://help.ubuntu.ru/fullcircle/22/web- development_h3
http://linux-user.ru/distributivy-linux/programmy-dlya-linux/lokalnyj-server-lamp-dlya-ubuntu-linux-mint/
http://ubuntovod.ru/instructions/web-server-ubuntu-php-mysql.html Apache shows its default page. Changing, as stated in the articles above, does not work (ie, I change, but the result is zero) for the sudo service apache2 restart command. The Apache curses and shuts down.

Using sudo apt-get install lamp-server^ mysql flies, so put everything manually. I guess I messed up with an apache, but I don't know where. In sudo gedit /etc/apache2/sites-available/test.com.conf wrote

 ServerName tset.com ServerAlias www.test.com DocumentRoot /home/anton/php/test.com/public 

Further

 sudo a2ensite test.com sudo /etc/init.d/apache2 reload 

writes:

 [....] Reloading apache2 configuration (via systemctl): apache2.serviceapache2.service is not active, cannot reload. failed! 

I do sudo gedit /etc/hosts final hosts view:

 127.0.0.1 localhost test.com 127.0.1.1 anton-N751JK 127.0.0.1 test.com # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 

default-ssl.conf did not change

in /home/anton/php/test.com/public created index.html with text. I go to test.com and get: I can not access the site

What did I do wrong or not? Tell me please!

All the manuals that came across to me were written in 2011-2014. As I understand it, the versions of the packages have changed, many commands have become unnecessary. Tell me a good guide! or how to start mastering php - minimally so that something even worked.

PS: before this is coding on ruby, everything works out of the box. And yes, I absolutely do not understand anything in adminstvo and working with servers, there are such people, be tolerant.

  • So why do you need ubunt lamp? Apache will already be the default. Install php and muscle via apt-get install php and apt-get install mysql-server . - Max ZS

2 answers 2

Actually, in php from version 5.4 there is a local server and it starts here

 php -S localhost:8080 file.php 

Where

  1. -S - start the server
  2. localhost - ip address or domain
  3. 8080 - server port
  4. file.php - file for processing requests, empty by default

There are downsides:

  1. It processes all requests in one file (since it was developed under the zend framework) for me it’s not a problem, all my projects use one file to process requests.
  2. Server for development only

All of the listed disadvantages are a kind of advantages because:

  1. Light does not clog memory and percents (it is easier to nginx) to compare with a monster named apache in general, and the development environment on it is just computer abuse, it’s better to use precious machine resources for idea, php, mysql than for apache web server.
  2. Made specifically for the development of the logs immediately displayed in the console, displaying errors one line in the code.
  3. Does not handle statics.
  • thank you very much! That is exactly what I needed! - ToshiDono
  • @ToshiDono Contact us! Good luck in learning php. - Naumov

Here is an excellent http://senokosov.info/lamp/install-lamp manual.

And why don't you try using docker or vagrant - and you don’t need to configure anything.

  • lamp first came out on request ubuntu local server - ToshiDono
  • I can not restart Apache with the sudo service apache2 reload command. Writes apache2.service is not active, cannot reload. - ToshiDono
  • corrected in 00-default.conf to the original settings. now does not require a reboot, but the test site does not start. - ToshiDono
  • how to use vargant or docker? Does it not complicate the task? additional virtual machines .. I'm lost. Is php development always so tangled? - ToshiDono
  • @ToshiDono, you are confusing yourself, trying to act in Windows as in Windows. Linux initially has everything you need, and no crutches in the form of * amp is required here. - PinkTux