• Resolved daubac402

    (@daubac402)


    I have 2 test sites at
    mydomain.com:8080 and mydomain.com:8081

    I installed on both sites this plugins and configured it to target each other.

    I make a new post in site :8080 then, check at the checkbox to save to 2nd site, after all choosing “Save as draft” or “Publish” but site :8081 doesn’t change anything.

    This plugin also doesn’t have any tool or a way for user to make sure that the connection between 2 sites is success or not ??

    • This topic was modified 2 years, 10 months ago by daubac402.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter daubac402

    (@daubac402)

    If I create a new post in site :8080, no error but nothing changed ??
    When I update “Hello world” post then check Network log, It is a 500 error from POST request to mydomain.com:8080/wp-admin/post.php?post=1&action=edit&meta-box-loader=1&meta-box-loader-nonce=82860aa7a4&_locale=user

    {
        "code": "internal_server_error",
        "message": "<p>There has been a critical error on this website. Please check your site admin email inbox for instructions.</p><p><a href=\"https://www.ads-software.com/support/article/faq-troubleshooting/\">Learn more about troubleshooting WordPress.</a></p>",
        "data": {
            "status": 500
        },
        "additional_errors": []
    }

    This is PHP error log:
    PHP Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /var/www/html/wp-content/plugins/sync-post-with-other-site/includes/sps_sync.class.php:122\nStack trace:\n#0 /var/www/html/wp-includes/class-wp-hook.php(307): SPS_Sync->sps_save_post(1, Object(WP_Post), true)\n#1 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)\n#2 /var/www/html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)\n#3 /var/www/html/wp-includes/post.php(4687): do_action('save_post', 1, Object(WP_Post), true)\n#4 /var/www/html/wp-includes/post.php(4789): wp_insert_post(Array, false, true)\n#5 /var/www/html/wp-admin/includes/post.php(426): wp_update_post(Array)\n#6 /var/www/html/wp-admin/post.php(227): edit_post()\n#7 {main}\n thrown in /var/www/html/wp-content/plugins/sync-post-with-other-site/includes/sps_sync.class.php on line 122, referer: https://nha201.tplinkdns.com:8080/wp-admin/post.php?post=1&action=edit

    And this is $respond object at /var/www/html/wp-content/plugins/sync-post-with-other-site/includes/sps_sync.class.php on line 122

    object(WP_Error)#1067 (3) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(59) "cURL error 28: Connection timed out after 5002 milliseconds" } } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } } {"code":"internal_server_error","message":"
    There has been a critical error on this website. Please check your site admin email inbox for instructions.<\/p>
    
    Learn more about troubleshooting WordPress.<\/a><\/p>","data":{"status":500},"additional_errors":[]}
    • This reply was modified 2 years, 10 months ago by daubac402.
    • This reply was modified 2 years, 10 months ago by daubac402.
    • This reply was modified 2 years, 10 months ago by daubac402.
    • This reply was modified 2 years, 10 months ago by daubac402.

    Same problem,have you solved this?

    Thread Starter daubac402

    (@daubac402)

    @jaywang
    Yes, I solved.
    Please check your Chrome debug tool, in the Network tab, you will see 500 error after saving a post.

    Thank you for your reply.
    Yeah, I have seen the 500 Interal Error in the Network tab. But I don’t know how to solve it. Can you figure out how to solve this problem. I’m a beginner in wp plugin development.
    I have installed two wordpress site on my mac. The first site is localhost:8081/wordpress/ installed locally with XAMPP. The second one is localhost:8000/ installed by docker on my mac.
    I can successfully synchronize posts from 8081/wordpress to 8000, but got internal server error while synchronize posts from 8000 to 8081/wordpress (our error log are the same!).
    What can I do to fix this?
    My wordpress version is 6.0 by the way.
    Thank you so much anyway!!

    • This reply was modified 2 years, 9 months ago by jaywang.
    • This reply was modified 2 years, 9 months ago by jaywang.
    Thread Starter daubac402

    (@daubac402)

    @jaywang
    1. If you see error code 500. It means that some server error has occured. So you need to check your server error log to determine what thing that cause the problem.

    2. In your case. I got it.
    Maybe because you expose your docker container to listen on port 8000.
    So your 8081 (XAMPP) site can easily connect to it.
    But from docker container itself. Certainly, it run in its virtual docker bridge network, and if you try to connect to localhost:8081. Your container doesn’t see anything running on 8081 port because “localhost” now means itself (not your “localhost” of your host machine).

    So what you have to do is you have to change in the sync post plugin setting in docker site from “localhost:8081” to “host.docker.internal:8081”. I think it will work.
    See more at: https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

    • This reply was modified 2 years, 9 months ago by daubac402.

    WOW! That’s awesome!
    I got it and it works.
    * I check the network connection on docker
    curl localhost:8081/wordpress/ and it returns ‘curl: (7) Failed to connect to localhost port 8081: Connection refused’. So I change localhost to my real ip and get HTML successfully. Then I change the wordpress and site address to my real ip, reset the plugin, and the post successfully synchronize from docker site to local site.
    * I think change localhost to host.docker.internal also works, I’ll check later.
    Thank you so much and have a good day!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Simply not working :(’ is closed to new replies.