David David - 4 months ago 40
PHP Question

file_get_contents in codeigniter on shared host

In my code igniter project in WAMP I'm able to do this and it works:

file_get_contents('C:\wamp\www\codeigniter\application\controllers\calendarmonth.sql');


I can't seem to figure out which path to use when it's on my live shared hosting site.

When I do

file_get_contents(base_url() .'application/controllers/Calendarmonth.sql');


I get "HTTP request failed! HTTP/1.1 403 Forbidden"

Answer

Move the Calendarmonth.sql file outside application folder.

If exist set allow_url_fopen in php


FYI

application/controller path will secure always. So if adding external file add to outside of application. Application root is always accessible.


Links

  1. ini_set not working