CURL is not working locally

0

Personal I have 2 applications in Laravel 5.5 running locally. One is the API and the other is a frontend. The API I configured it as a vhost in the WAMP Server as the name api2018.local and I configured CORS in Laravel for this API route. So long. In the frontend application I run via artisan serves and I get access to the API using PHP's CURL without any problems. But then I set up a vhost called frontend2018.local on the Wamp server. Oh, I can only get 500 error in CURL. Does anyone know why this? Thanks

    
asked by anonymous 02.04.2018 / 17:01

1 answer

1

This happens when we use two services on the same port, usually the 80 port. This creates a conflict and the code ends up not being a process by any of them. To fix it we need to change their port, in this case, give preference to change the WampServer port, since it starts automatically, without the need to configure it every time.

Changing the port in WampServer

To change the port for this service, we need to change a file. For this we can access the config of Apache folder. This - usually - stays in C:\wamp\bin\apache\apache<versão>\conf . When you find it, just open the file httpd.conf and find the code below:

Listen 0.0.0.0:80
Listen [::0]:80

Once you've done this, just change the :80 values to another value between 0 and 65537 , for example:

Listen 0.0.0.0:8080
Listen [::0]:8080

Once you've done that, just restart the server.

  

Check if there are no other services running on the port.

Tip: Another way is to click the WampServer icon next to the Windows clock > > Apache > link

Using other ports in artisan

In the artisan is simpler, just run the command below.

php artisan serve --port=8080
    
02.04.2018 / 22:15