5

I have a problem with the PHP realpath always returning false how ever I pass the file path string.

By default I pass this the the realpath() "/shop/templates/default/css/reset.css", I have also tried:

What could be causing this to break?

3
  • 2
    Realpath() works for filesystem paths only. Does /shop/webapp/templates/default/css/reset.css actually exist on your system? /shop being a folder in the root path? Commented Sep 18, 2011 at 14:15
  • 1
    Pekka, have you started posting comments instead of answers so that other people can post your comment as an answer? Commented Sep 18, 2011 at 14:19
  • @Blair not as a rule, no! But I felt this specific case needed some clarification first. (Still, of course, everyone is welcome to post a fully fleshed-out answer from comments) Commented Sep 18, 2011 at 15:02

1 Answer 1

11

Are you sure you have the correct path? It probably doesn't start with /shop in the filesystem.

Are your permissions correct?

realpath() requires:

  1. That the file / path actually exist.
  2. Read permission for the entire directory hierarchy.

realpath() doesn't work with URLs.

Sign up to request clarification or add additional context in comments.

1 Comment

You right thanks, I needed to pass absolute files like: C:\wamp\www\shop/webapp/templates/default/css/reset.css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.