[wp-trac] [WordPress Trac] #37220: Improvement symlinks on wp-config.php

WordPress Trac noreply at wordpress.org
Wed Jun 29 07:52:17 UTC 2016


#37220: Improvement symlinks on wp-config.php
----------------------------+-----------------------------
 Reporter:  grazianognoll   |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Bootstrap/Load  |    Version:  4.5.3
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Hello,
 i noticed working on a wordpress website that if the website is in a
 directory (es. /var/www/releases/3/) and the web root is pointing through
 a symbolic link ( so. /var/www/current/ pointing to /var/www/releases/3/ )
 the function in the wordpress config is not retrieving the right
 directory:

 if ( !defined('ABSPATH') )
         define('ABSPATH', dirname(__FILE__) . '/');

 I solved manually defining ABSPATH to the right directory, but i think it
 would be better to fix if maybe checking if the directory is a symlink.

 The problem is that from php5 __FILE__ is reporting the absolute path, so
 it may be better to use $_SERVER['PWD'] to retrieve the path:
 <?php echo $_SERVER['PWD'] ."\n"; ?>
 would be
 /var/www/current

 Thanks,
 Emanuele.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37220>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list