Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20059 closed defect (bug) (wontfix)

APC + hard link + __FILE__ doesn't work

Reported by: rootix Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: close
Focuses: Cc:

Description (last modified by scribu)

I want to manager some wordpress with only one code replication. So i make hard link (only wp-config.php, directories and some file are uniq and writable by users)
__FILE__ is generated at compile time and there is lot of problems.

I tried this (in wp-load.php) and it seems to work better :

/*define( 'ABSPATH', dirname(__FILE__) . '/' );*/
define( 'ABSPATH', dirname($_SERVER["SCRIPT_FILENAME"]) . '/' );

Change History (7)

comment:1 scribu2 years ago

  • Description modified (diff)

comment:2 follow-ups: dd322 years ago

  • Keywords close added

Simple; Don't use a hard link, it confuses PHP..

~/public_html/example.com/wordpress/ ==symbolic link==> /home/.../wordpress/
~/wordpress/ (with all the WordPress core files here)

You can define custom content directories, or plugin directories in the wp-config.php, and after install, you'll need to change the Home/Site url's to match what you expect (home: http://example.com/wordpress/ and site: http://example.com/)

I use this exact configuration with APC and PHP, and it works fine, upgrades can sometimes confuse you when it's run on one site, but not all.. and further, MultiSite is a better option for most scenario's where you just want multiple blogs to run from the single codebase.

comment:3 scribu2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Also note that $_SERVER["SCRIPT_FILENAME"] and __FILE__ are not equivalent. The former will always point to the parent file (the one that would show up in URL bar when there are no rewrite rules).

So, as dd32 suggested, you'll have to use a different setup.

comment:4 qdinar2 years ago

hello. i have same problem. i asked about it in freenode and fixed it, but now i see other problem - tinymce advanced plugin do not work. i have come to this trac now to open ticket about that wp should be made working with hardlinks. but may be i should not.

comment:5 in reply to: ↑ 2 qdinar2 years ago

Replying to dd32:
"custom content directories, or plugin directories in the wp-config.php"

i use same plugins directory now with hardlinks and softlinks ... (add after 86 minutes) probably it is possible with editing wp-config.php also

Version 2, edited 2 years ago by qdinar (previous) (next) (diff)

comment:6 qdinar2 years ago

i provide links, may be they will be useful for somebody, like me, i searched and found them just now:



comment:7 in reply to: ↑ 2 qdinar2 years ago

Replying to dd32:
"You can define custom content directories, or plugin directories in the wp-config.php"

how to do it ?

i have tried to write in wp-config.php , (wp-config.php is in "fake" directory, where many other files are links):


("/var/www/saytlar/wordpress/" is place where real wordpress files are located, with plugins and themes, but without caches and uploads and without config)

but it has not helped.

i have searched "wp custom plugin directory" and "WP_PLUGIN_DIR" in google but have not found useful thing . with "WP_PLUGIN_DIR" i wanted easily find where it is defined.

Note: See TracTickets for help on using tickets.