Plugin not working after update to 6.0
-
Hi,
I still have the blank screen. You have offered to help, but I did not receive any notification about your reply.
Can you please help me solve this, it is really annoying to keep rolling back, since the filters allowing to choose what plugin updates seem not to work at times.
-
Hi retetecugust,
If it is requiring in only “/wp-admin/admin-ajax.php”, then it is referencing the root directory of the hard drive. I’m not quite sure why it would be doing this…
As you can see here, there’s nothing fancy going on. There’s no code there that is too new to run on their servers, this is bizarre. Your use-case might require some more in-depth debugging. Are you confident enough to do this?
@thatsinsurance did you have the same error in your logs as is above?
Thanks,
Shane Thompson
Hi,
Can you use the method wp_localize_script() instead of that dirname you are using ? I saw this example here https://premium.wpmudev.org/blog/using-ajax-with-wordpress.
What kind of debugging you need ? I don’t have confidence issues, the problems would be the modalities of debug I am allowed to use on this server.
Hey,
wp_localize_script is used for a very different use case in context to ajax.
And debugging is not a problem – I’d like to see what dirname is doing at every step… i.e.
$dir = __FILE__; var_dump( $dir ); $dir = dirname( $dir ); // src var_dump( $dir ); $dir = dirname( $dir ); // aceide var_dump( $dir ); $dir = dirname( $dir ); // plugins var_dump( $dir ); $dir = dirname( $dir ); // wp-content var_dump( $dir ); $dir = dirname( $dir ); // WP var_dump( $dir ); $dir .= '/wp-admin/admin-ajax.php'; var_dump( $dir ); require_once $dir;
This should work on any server. This will, however output the full path of the WordPress installation. If you have issues publishing that, please feel free to send the output to:
me (at) shane (dot) pt
Thank you for your patience!
Shane Thompson
Unfortunately, I cannot see the logs so that is not useful :(.
Can’t you use other functions for this ? like plugin_dir_path () or maybe admin_url(‘admin-ajax.php’); Something that could get the whole path for you in a sole instance, without calling so many times the dirname.
-
This reply was modified 6 years, 12 months ago by
retetecugust.
I tried talking to them, but they insist this cannot be done because it requires access to the directory path and that is not available. So can’t you just do how it was done before, in previous versions ?
Hi again,
var_dump will output the variable in the browser, so it will be the contents of the ajax response. You will have to watch the ajax request in the network tab.
The functions you mentioned, they all use dirname inside them. Not only that, the WordPress plugins you mentioned are WordPress specific and as such are not available until admin-ajax has been included.
They are telling you why you are having this issue, whereas I’m trying to figure out how we got there. If you place the above modifications in the src/Ajax.php file, I’ll have a better idea what’s going on and we can figure out the solution ??
Thanks
Shane ThompsonHi,
It builds the file path properly, I saw it when I commented the require instruction. But when using require it crashes. You cannot access files like that on this server, they don’t allow this.
I assume you used another way in previous versions which works, so maybe you can find a way around it.
Hey,
It doesn’t build the path properly.
The path that is being required is /wp-admin/admin-ajax.php, where the initial forward slash indicates the top directory of the hard drive in the server, not the top directory of the WordPress install. This path does not exist, and as the WP.com guys are saying, there are no permissions to access this location.
If you examine the error message, the wp-content directory sits in its own directory – which is the same directory as wp-admin:
PHP Fatal error: require(): Failed opening required ‘/wp-admin/admin-ajax.php’ (include_path=’/:.’) in /wpcom-19758243/wp-content/plugins/aceide/src/Ajax.php on line 23
Therefore I expect to be requiring this file:
/wpcom-19758243/wp_admin/admin-ajax.php
However somewhere, it is going wrong. With the code I sent above, we can see each step that is being taken to traverse up a directory and can see where things are going wrong. If you can help me by providing this output then I can help you by fixing the plugin.
Thanks for your cooperation
Shane ThompsonExactly, that is the path it builds. At the end the path is what you would expect, as written above. As I said it builds it properly, but when trying to include it, it crashes. Probably that directory is not allowed to be used like that.
Please delete all the mentions of that directory here in this discussion.
I’m not sure where the disconnect is here…
The path it is building, and is attempting to require, as evidenced by the error message is as follows:
/wp_admin/admin-ajax.php
Do you disagree with this?
The WP install as evidenced by the error message is at:/wpcom-19758243
And therefore the path that we should be requiring should be as follows:
/wpcom-19758243/wp_admin/admin-ajax.php
The path for the WordPress install will have all appropriate permissions for us to include files, otherwise the whole website would not run at all. This is the directory in which we have files like wp-blog-header.php and (usually) wp-config.php that bootstrap the whole environment.
Thanks
I don’t know what to tell you, but one of the support persons from there said that this plugin is trying to access the file-tree and this is not permitted. This file is not accessible with the domain name either.
But the way you are using it seems not to be a best practice, as far as I searched, I found only examples and uses with a js file and wp_localize_script, none with trying to include that file, but only using it for ajax calls.
Hi again,
Yes I understand, he is referring to server-side filesystem permissions.
I can only assume you are unfamiliar with the Linux filesystem – if this is not the case, sorry in advance.
The plugin is attempting to include /wp-admin/admin-ajax.php whereas it should be accessing /wpcom-19758243/wp_admin/admin-ajax.php.
The equivalent paths in windows would be:
C:\wp-admin\admin-ajax.php
and
C:\wpcom-19758243\wp-admin\admin-ajax.phpObviously, /wp-admin doesn’t even exist, but your WordPress installation can’t even see folders in / – this is why your server admin as saying we don’t have access. He’s spot on, we don’t have access there.
I’m not trying to figure out why we can’t read that directory. I’m trying to figure out why it determined that this is the directory to be reading from, when it should be under the /wpcom-19758243 directory. Do you agree/disagree or not understand this?
There is obviously a divide in our thinking here as to what we are trying to achieve. I want to make sure 100% that we are on the same path.
In regards to wp_localize_script, and any other WordPress-specific functions for that matter, they are not an option. They don’t even exist until we have included the admin-ajax file.
Thanks,
Shane ThompsonThis is the third time I am telling you, the path is trying to require is correct, it is /wpcom-19758243/wp-admin/admin-ajax.php. I just do not want to write that root file, and I have asked you to do the same, but you still write it all over the place. The path it takes into the require instruction is correct ! But inside require something crashes, probably some file permissions and stuff, or firewall, I don’t really know. The message it is writing to output does not contain that folder, probably for protection purposes, but it does require the right path.
I don’t think there is something you can do, unless you try to load the files for editing in another way, maybe how you did it in previous versions.
-
This reply was modified 6 years, 12 months ago by
- The topic ‘Plugin not working after update to 6.0’ is closed to new replies.