Tag Archives: compile

  • PHP scripts using __FILE__ break when they are moved

    View Comments
    magic constants in the php manual

    The __FILE__ magic constant contains the full path to the PHP script that it is being used in. The path used is local, not remote. Local paths are meant to be used when dealing with other files in the file system, such as when using the include, include_once, require, and require_once directives, and when opening, editing, and saving files on the server. Since the path on every server is going to be different, and since it’s a value that you expect the average user to be unaware of, using the __FILE__ magic constant allows an application to learn the path without requiring the user to learn it, first. But, once a file using the __FILE__ magic constant is moved, difficulties arise.

    Read More »
    Did you like this? Share it: