php cURL to localhost returns permission denied on an open port

前端 未结 1 1649
遥遥无期
遥遥无期 2021-01-07 08:06

I\'m getting a permission denied error when trying to make a cURL request with the php cURL library to localhost on port 4321. This will hopefully be really easy or obvious

相关标签:
1条回答
  • 2021-01-07 08:55

    I found the answer to the problem at: Getting permission denied while Posting xml using Curl?

    The problem is SELinux and the solution is to run:

    sudo setsebool httpd_can_network_connect 1
    

    It doesn't make sense to me that I could use the php cURL library to access every other website in the world, but not localhost on a different port, while I was able to access the localhost from command line cURL.

    0 讨论(0)
提交回复
热议问题