David David - 1 year ago 212
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:


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 Source

Move the Calendarmonth.sql file outside application folder.

If exist set allow_url_fopen in php


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


  1. ini_set not working
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download