Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using Ubuntu Linux. I have a web server(Apache). In my localhost I kept my php code and one json file. Through my php code i want to load my json file. My problem is nither I load my json file nor I getting any error. Every time It is showing my json file loaded successfully. But i can not see the data.

After couple of days searching in the net I am assuming that this is because of Apache's same origin policy. May be i could not set it up properly. Now, How should I do it?


This is not possible to load any json file from localhost to my script directly. Is this true? If so how should I solve this?

share|improve this question
Where is the json-file located? –  Bart De Vos May 2 '12 at 7:51
inside my "localhost/project/data/somefile.json"; –  Shahjalal May 2 '12 at 8:22
I would figure that everything that is outside the /var/www would not be accessible to apache. Have you tried moving it to /var/www ? –  Bart De Vos May 2 '12 at 8:36
Same origin is nothing to do with the problem here. More likely its a permissions error / PHP is running with an open_basedir / the path evaluation is wrong - all of which will be reported as errors/notices by PHP if you've got your error reporting setup correctly. –  symcbean May 2 '12 at 14:19
@BartDeVos yes, my everything is inside /var/www folder which is my localhost default location. –  Shahjalal May 6 '12 at 9:39
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.