Jump to content

Issues with Symlinks


Darghon

Recommended Posts

Hello all,

 

I have a server setup that contains an web application at location x, and a "subdomain" at location y, with a public_html symlink to location x.

Now, I've added a virtual host to the system pointing to the symlink in subdomain y.

The config files that the application requires to work (subdomain specific) are contained on the same leven as the symlink, so the application would need to move up 1 directory to access the config data. require(../config/config.php)

 

Now the server says it can't access the file, even though it is there.

 

I've managed to fix the problem for now by using this little piece of code:

require_once(str_replace('public_html','config/config.php',$_SERVER['DOCUMENT_ROOT']));

 

But I would guess that doing require('../config/config.php') would do the same...

why not? and if possible how can I fix this, because the subdomain folder contains more then just the config data, (also user files etc...) so it would be best if the symlink would work as expected...

 

thx in advance, and if anything is unclear about my question, do let me know, and I'll try to clearify everything.

 

Vhost file (censored):

<VirtualHost *:80>
ServerName demo.somedomain.org

DocumentRoot /home/demo.somedomain.org/public_html

<Directory /home/demo.somedomain.org/public_html/>
Options Indexes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>


ErrorLog /var/log/apache2/app/demo.somedomain.org.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/app/demo.somedomain.org.access.log combined
</VirtualHost>

Link to comment
Share on other sites

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.