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
https://forums.phpfreaks.com/topic/257466-issues-with-symlinks/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.