Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Installing Wordpress SEO (an a few others but not all plugins) gives the following console error:

GET http://craigmdennis.com/content/plugins/nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/wordpress-seo/js/wp-seo-admin-global.js?ver=1.2.5 404 (Not Found)

For some reason it is listing the complete server path after my url. It seems as though /nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/ or http://craigmdennis.com/content/plugins/ should not be present in the url.

Here is the directory structure (please note the custom content directory):

wp/
content/
content/themes/
content/plugins/
.htaccess
index.php
wp-config.php

I am not running MU. I also have a subdomain for media (shouldn't be effecting the issue but I'm listing it for completedness)

Here are the relevant parts of my wp-config.php file:

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp');

define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST']);

define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/content');

define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');

Does anyone know what's going on here? Thanks.

[EDIT] I think it's related to __FILE__ and not DOCUMENT_ROOT as the plugins all use __FILE__ to get the directory name. This provides /nfs/c08/h04/mnt/ instead of /home/.

When I echo the location of the plugins_url() I get /home/152547/domains/dev.craigmdennis.com/html/content/plugins which is correct but when I pass in FILE as a parameter I get the aforementioned /nfs/c08/h04/mnt/152547/domains/dev.craigmdennis.com/html/content/plugins/{plugin-folder}.

Could this be something to do with PHP resolving aliases for __FILE__ This would explain why it works on my local server (with no aliases) and doesn't on Media Temple (which may alias /nfs/c08/h04/mnt/ for /home/ Is this a Wordpress issue or an issue on my server?

share|improve this question
    
We'll need to see more code here. Can include the bits specifically regarding the JS enqueue? –  Brian Fegter Jul 23 '12 at 1:59
    
Based on @kalengi Answer, what if you also define WP_PLUGIN_*? –  brasofilo Jul 23 '12 at 12:28
    
Can you be more specific? Do you mean the enqueue in my theme's functions.php of the enqueue used within the affected plugins? –  Craig Jul 23 '12 at 12:30
    
@brasofilo I have tried explicitly defining WP_PLUGIN_DIR but have only just noticed WP_PLUGIN_URL can also be defined. I will try these again. –  Craig Jul 23 '12 at 12:33
    
This Q&A may be useful: wordpress.stackexchange.com/q/1507/12615 –  brasofilo Jul 23 '12 at 13:12
show 7 more comments

2 Answers

up vote 0 down vote accepted

The error is the result of the php __FILE__ resolving any aliases or symlinks on the server.

The solution is to set define('WP_CONTENT_DIR', dirname(__FILE__) . '/content'); so it is also the absolute file path on the server after resolving aliases.

See: http://php.net/manual/en/language.constants.predefined.php#104842

share|improve this answer
add comment

Given that the js location is determined as follows:

$js_location = WPSEO_URL . 'js/wp-seo-admin-global.js'

where:

WPSEO_URL = WP_PLUGIN_URL . '/' . <WP_SEO_PLUGIN_PATH> . '/'

I suspect the problem lies with the derivation of <WP_SEO_PLUGIN_PATH>. This value is determined by the code in the function plugins_url() found in wp-includes\link-template.php

If you debug that function, it may yield the reason why <WP_SEO_PLUGIN_PATH> is producing the wrong value: 'nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/wordpress-seo'

share|improve this answer
    
I doubt it is anything to do with the Wordpress core files or the plugin as it works fine locally. I think it is a server configuration issue or incorrect file path somewhere. –  Craig Jul 23 '12 at 21:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.