telsiin Posted March 17, 2008 Share Posted March 17, 2008 Hello everyone I am a new at this and I having some trouble getting this to work for me What I am try to do is setup I think should a path or alias to my database connection folder and the are not in the same directory. but I missing some step as its not working. I am running xampp and had everything in the same directory but as downloaded different php application I was advise that my setup was not Secure and I should move my connection file to an area that was not under the same directory as my Document root so guess I need to start with my Document root which is C:/lordsofansalon/htdocs/home/ And I am trying to access a connection file lordsofansalon.php under Directory C:/lordsofansalon/Connections/ in my httpd.conf I attempted to create an Alias Alias /home/connect "C:/lordsofansalon/Connections" <Directory "C:/lordsofansalon/Connections"> Options +Indexes Order allow,deny Allow from all </Directory> I tried to access it through a require_once <?php require_once('/home/connect/lordofansalon.php'); ?> And received this error Warning: require_once(/home/connect/lordofansalon.php) [function.require-once]: failed to open stream: No such file or directory in C:\lordsofansalon\htdocs\DM\playeraction.php on line 1 Fatal error: require_once() [function.require]: Failed opening required '/home/connect/lordofansalon.php' (include_path='.;C:\lordsofansalon\php\pear\') in C:\lordsofansalon\htdocs\DM\playeraction.php on line 1 also the page that is calling it is under C:/lordsofansalon/htdocs/DM/ don't know how important that detail may be Also if someone could advise me on a good reference/how-to book on apache 2.2 I would really appreciated Thank you in advance Antonio Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 17, 2008 Share Posted March 17, 2008 When you include files via PHP, PHP requests for files via the OS not Apache. If you used require_once "http://yoursite.com/home/connect/lordofansalon.php" then it'll work however PHP wont include the PHP source code only the output of the included php file. When including files I always do this: define('ROOT', $_SERVER['DOCUMENT_ROOT']); include ROOT . '/path/to/file.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.