CURL is not working locally

Asked

Viewed 280 times

0

People 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 WAMP Server as the name api2018.local and I configured CORS in Laravel for this API route. So far so good. In the frontend application I run via Artisan serves and I can access the API using CURL PHP without problems. But then I set up a vhost called frontend2018.local on Wamp server. I can only get error 500 on CURL. Does anyone know why this? Thank you

  • You are probably using two services at the same door.

  • Thanks @Valdeirpsr, that’s right. If you want to post as an answer for me to mark you. Thanks

1 answer

1


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


Changing the port on Wampserver

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

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

Once done, just change the values :80 for another value between 0 and 65537, for example:

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

Once done, just restart the server.

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

Tip: Another way is to click on the icon of Wampserver next to the clock of Windows > Apache > httpd.conf


Using other doors in the Artisan

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

php artisan serve --port=8080

Browser other questions tagged

You are not signed in. Login or sign up in order to post.