0

I completed the search.php file, but when I try to run it, I get this error:

Warning: file_get_contents(/home/ubuntu/workspace/pset8/includes/../config.json): failed to open stream: Permission denied in /home/ubuntu/workspace/pset8/vendor/library50-php-5/CS50/CS50.php on line 95

Fatal error: Could not read /home/ubuntu/workspace/pset8/includes/../config.json in /home/ubuntu/workspace/pset8/vendor/library50-php-5/CS50/CS50.php on line 98

When I open my website, the permissions are fine for the home page, so I am not sure if this is a problem with my search.php or with the permissions.

This is my search.php file:

<?php
    require(__DIR__ . "/../includes/config.php");
    $places = [];
    $places = query("SELECT * FROM places WHERE MATCH(postal_code, place_name, admin_name1)
             AGAINST (?) LIMIT 20", $_GET["geo"]);
    header("Content-type: application/json");
    print(json_encode($places, JSON_PRETTY_PRINT));
?>

Any help is very much appreciated!

1 Answer 1

1

The lines referenced by the error messages appear to be in the area of CS50.php where it is looking up the configuration file. Make sure the permissions on pset8/includes/config.php pset8/config.json are 644 (as in chmod 644 config.json).

2
  • 1
    I think he urderstood anyway, but a minor detail: config.json Commented Nov 30, 2016 at 18:40
  • Thanks @YuriLaguardia, I was looking at last year's pset. Commented Nov 30, 2016 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .