Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Erik

    (@codekraft)

    Ciao @senjoralfonso ,
    A 500 on that address is very strange because, that is the address of the WordPress Rest-Api… On that website are you able to load the data from an endpoint like https://yourwebsite.com/wp-json/wp/v2/posts ?

    AFAIK the issue could be then most likely a path problem, are you using the site locally for example with wp-env? Is the issue that you are referring similar to this one?

    ps. as always thanks for the support ??

    • This reply was modified 1 year, 7 months ago by Erik.
    • This reply was modified 1 year, 7 months ago by Erik.
    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hi @codekraft,

    the page is online, I don’t use wp-env. There are at least four pages on my server with this error. Deactivating AntiSpam solves the problem, but its not really a solution.

    Your given endpoint is working on the page.

    Plugin Author Erik

    (@codekraft)

    Ok thanks for providing more info! I definitely have to investigate this issue, it seems the cf7a plugin cannot fetch the rest-api with most recent php versions then (and maybe yes the issue is related to php >= 8.2)!

    Thread Starter WebCodePoet

    (@senjoralfonso)

    @codekraft are there any information about your progress about php 8.2 compatibility?
    Currently I have to leave the plugin disabled, and that’s annoying because a lot of spam gets through.

    Plugin Author Erik

    (@codekraft)

    ciao @senjoralfonso I am working on it and should have fixed the main problem… However, I have to check the rest of the plugin, if you wish I will release a beta on GitHub to cover this temporary lack.

    Thread Starter WebCodePoet

    (@senjoralfonso)

    No, no, you don’t need to, it’s enough work to make the 0.4.6 stable I think, I will be patient.

    Plugin Author Erik

    (@codekraft)

    Hi @senjoralfonso,

    The release is ready and tested but It would be cool to get a confirmation that it solves your issue with php 8.2.
    Here is the download link, https://github.com/erikyo/cf7-antispam/releases/tag/v0.4.6-beta

    Could you please give be so kind to give a try?
    I would not like to make releases very close in time, but at the same time I would like to be sure that I have solved the problem with php >8.1 (I have only been able to test it out on a couple of sites, one of which is virtualised, I’m sure it won’t break anything though)

    thank you again!


    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hey @codekraft,

    I have tested the new version, it seems to work. I can send emails.

    In the log there is still an error:

    [17-May-2023 18:01:08 UTC] PHP Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/includes/cf7a-antispam-b8.php on line 51
    [17-May-2023 18:01:08 UTC] PHP Fatal error: Uncaught Error: mysqli object is already closed in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/mysql.php:44
    Stack trace: 0 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/mysql.php(44): mysqli->real_escape_string() 1 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/storage_base.php(115): b8\storage\mysql->fetch_token_data() 2 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/storage_base.php(98): b8\storage\storage_base->get_internals() 3 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/b8.php(116): b8\storage\storage_base->__construct() 4 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/includes/cf7a-antispam-b8.php(75): b8\b8->__construct() 5 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/includes/cf7a-antispam-b8.php(29): CF7_AntiSpam_B8->cf7a_b8_init() 6 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/includes/cf7a-antispam-filters.php(938): CF7_AntiSpam_B8->__construct() 7 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp-hook.php(310): CF7_AntiSpam_Filters->cf7a_spam_filter() 8 /var/www/vhosts/domain.com/httpdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters() 9 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/submission.php(718): apply_filters() 10 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/submission.php(92): WPCF7_Submission->spam() 11 [internal function]: WPCF7_Submission->{closure}() 12 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/l10n.php(147): call_user_func() 13 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/submission.php(131): wpcf7_switch_locale() 14 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/submission.php(35): WPCF7_Submission->proceed() 15 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/contact-form.php(1048): WPCF7_Submission::get_instance() 16 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/contact-form-7/includes/rest-api.php(357): WPCF7_ContactForm->submit() 17 /var/www/vhosts/domain.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1181): WPCF7_REST_Controller->create_feedback() 18 /var/www/vhosts/domain.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1028): WP_REST_Server->respond_to_request() 19 /var/www/vhosts/domain.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(442): WP_REST_Server->dispatch() 20 /var/www/vhosts/domain.com/httpdocs/wp-includes/rest-api.php(410): WP_REST_Server->serve_request() 21 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp-hook.php(308): rest_api_loaded() 22 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() 23 /var/www/vhosts/domain.com/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action() 24 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp.php(399): do_action_ref_array() 25 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp.php(780): WP->parse_request() 26 /var/www/vhosts/domain.com/httpdocs/wp-includes/functions.php(1334): WP->main() 27 /var/www/vhosts/domain.com/httpdocs/wp-blog-header.php(16): wp() 28 /var/www/vhosts/domain.com/httpdocs/index.php(17): require('…') 29 {main} thrown in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/cf7-antispam/vendor/l3u/b8/b8/storage/mysql.php on line 44
    • This reply was modified 1 year, 6 months ago by WebCodePoet.
    Plugin Author Erik

    (@codekraft)

    I’ve been investigating the issue you reported with the AntiSpam plugin and the 500 error on the WordPress REST API endpoint. While I haven’t been able to replicate the exact problem, I have made some changes that might help resolve the issue.

    In the plugin code, I modified the way it connects to the MySQL database by passing the $wpdb instance directly to the b8 object. This ensures that the necessary database connection details are properly provided. Additionally, this change may improve the compatibility with PHP 8.2.

    However, there might still be some underlying issues with the database connection, as indicated by the error message you shared: “No such file or directory.” This suggests that there could be a problem with the connection to the MySQL server or the MySQL socket file.

    To further investigate the issue, I would appreciate it if you could provide more information about how your WordPress database is connected. Specifically, it would be helpful to know if you’re using a custom configuration or if there are any unique server setups that might be affecting the database connection.

    Please let me know if the updated version of the plugin, which you can find here, resolves the problem for you. If the error persists, any additional details you can provide about the database connection setup would greatly assist in further troubleshooting.

    Thank you for your patience, and I apologize for any inconvenience caused by this issue.

    • This reply was modified 1 year, 6 months ago by Erik. Reason: adds a link to gh
    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hi again,

    about the connection:

    define( ‘DB_NAME’, ‘wordpress_’ );
    define( ‘DB_USER’, ‘wordpress_’ );
    define( ‘DB_PASSWORD’, ‘******’ );
    define( ‘DB_HOST’, ‘localhost:/var/run/mysqld/mysqld.sock’ );
    define( ‘DB_CHARSET’, ‘utf8mb4’ );
    define( ‘DB_COLLATE’, ‘utf8mb4_unicode_ci’ );

    I am currently uploading the plugin to my stack and will try if there are any messages in the log.

    Thread Starter WebCodePoet

    (@senjoralfonso)

    So far there are no entries in the log, it seems to be working as expected! ??

    Plugin Author Erik

    (@codekraft)

    ??! So expect a release at the beginning of the week (although you won’t see the update because it is the same one you already have installed)!

    Thank you again for the feedback!

    Plugin Author Erik

    (@codekraft)

    PS. the issue with the past method is related to the fact that I was “exploding” the db_host string by “:” and using the resulting second string as the port used to connect to mysql server (also I was doing intval() to sanitize the value so I think 0 was passed).

    The fix used in 0.4.6-beta2, directly passes the already initialised instance of mysqli (wpbp), so the problem should be ‘bypassed’ (or at least I hope so, let me know if there are any developments, of course)!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WP-JSON 500’ is closed to new replies.