-2

I'm building a php site and using MAMP pro on my mac.

I've got json.php echo'ing out some json when called directly, but when another script tries to call it using file_get_contents I get this error:

[26-Aug-2023 10:47:04 UTC] PHP Warning:  
file_get_contents(../json.php?endpoint=Organisations&action=list): Failed to open stream: 
No such file or directory in /Users/mymac/Sites/CKM/widgets/tenancy-picker.php on line 2

Is there a setting I need to change? I saw something about a php.ini setting but the thread was very old and it didn't indicate if I should find the right file and edit that or if there's a ux option to change it.

If I explicitly call it using the mamp URL I get this error message

Warning: file_get_contents(): SSL operation failed with code 1. 
OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /Users/mymac/Sites/CKM/widgets/tenancy-picker.php on line 3
Sarah K
  • 363
  • 2
  • 15
  • If the parameter doesn't start with `http:`, PHP assumes you want to open a local file. You don't have a local file with that name. Why don't you just put the code in a function and do `include "../json.php";` rather than invoke another web request? – Tim Roberts Aug 27 '23 at 05:49
  • It's not a bad idea, not that file but the one it calls, it could probably just be called directly. – Sarah K Aug 27 '23 at 06:22

0 Answers0