mesh2005 Posted May 29, 2008 Share Posted May 29, 2008 I setup a virtual host as follows: <VirtualHost 192.168.1.1> ServerAdmin webmaster@localhost ServerName frame DocumentRoot /home/username/Personal/framework <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/username/Personal/framework> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On </VirtualHost> I put a header.php in the /home/username/Personal/framework; I created a subdirectory called test and I put a script index.php inside test that has the following code: include "/header.php"; It fails and I get no such file or directory although the header.php is in the root of the virtual host. It seems that the / is not mapped to /home/username/Personal/framework, how can I fix this? Thank you AM Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 29, 2008 Share Posted May 29, 2008 PHP does not request for files over the http protocol. Instead it does it via the OS You should never begin file paths with a /. Starting file paths in this way tells PHP to look for files from the root of the hard drive. Rather than your sites document root. I recommend you to use include "./header.php"; or a better way would be include $_SERVER['DOCUMENR_ROOT'] . "/header.php"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.