S
S
Sergey Malinin2019-12-12 11:51:36
PHP
Sergey Malinin, 2019-12-12 11:51:36

How to work with Angular 8 and PHP on local server?

There is a task: to write an Angular site on the front and with php on the back, which will only receive and return json data and communicate with the database.
The question is how to make a bunch of Angular and PHP and SQL on a local server?
For PHP I use XAMPP, I build Angular through the standard np serve.
You can do np build and open it through another local server, but this is very inconvenient.
I understand that in this case it is better to use Node.js, but I need to make a bunch of Angular + PHP

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2019-12-12
@Casufi

Separate the flies from the cutlets, separate the visual part in Angular and the separate API in PHP, and then everything will become clearer to you.
Angular is a static site, you don’t need PHP and even Apache to serve it, add nginx to your stack
1) The main domain will serve a static site on Angular
2) Everything in the /api folder will be redirected to your XAMPP
Read about the RESTfull API and choose a convenient one a framework for you to implement it in PHP
I also recommend not to suffer with XAMPP and there is time to learn, read about docker

V
Vladimir Korotenko, 2019-12-12
@firedragon

I recommend that you do not suffer with Denvir and raise a virtual machine, and the same as that of a hoster, for example, debian.
Memory will take 512 MB. The main bonus is to avoid bugs on the production server related to the different behavior of mysql and nginx.
The only thing is to specify the ip address of the virtual machine in the hosts file c:\windows\system32\drivers\etc\hosts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question