Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/96590-help-with-aliaspath-and-include-file/
Share on other sites

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';

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.