PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm on a Windows server running the latest PHP version. When trying to 'require' or 'include' it is not allowing me to use the "/" to begin my paths to the source page. These includes will be on multiple pages throughout the directory levels so it is very important that this work. Should it not be working on my server (or in PHP at all)? Here is an example:
// the file name "file.php" is in a folder named "includes" on the root
<?php include('/includes/file.php'); ?> // will not work
<?php include('../../includes/file.php'); ?> // works fine
A leading / refers to the root of the filesystem and does work on win32 platforms with no problems.
For example, if you are working on your C drive and you request a file with the path '/includes/file.php' it will be looking for the file 'C:\includes\file.php' I'm guessing that your includes directory is not in the root of the file system?