i am using $_SERVER[‘DOCUMENT_ROOT’] to include a js file. The file path prints correctly when viewed via ‘view source’. but it is 404. whats the problem ?
Can I ask what you’re expecting to happen? My PHP knowledge is limited, but I’m reading your question as if you’re expecting a .js file to show up as if it were a webpage file. Is that correct, or are you expecting the .js to be embedded within something larger. What does the rest of the ‘view source’ look like?
Your starting point is above the public part of the site and files referenced from within the HTML must have either an absolute address or an address relative to the HTML.
You need to get rid of the part of the address quoted above.