1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

POST 500 internal server error?

Discussion in 'Nginx' started by Ramesh8248, Feb 28, 2015.

  1. #1
    I just build simple infinite loop for my WordPress blog. Its working great on LOCAL PC (WAMP), But its not showing any output on online website. I tried to debug it using FIREBUG. On the console i am getting this error

    POST http:// www. siteurl. com/infinite-loop.php 500 Internal Server Error​

    I am running my blog on nginx server. here is the code I am using...

    infinite-loop.php

    <?php

    $infinite_loop= $_POST['pcount'];?>

    <?php require_once("/wp-blog-header.php");?>

    <divclass="x-container-fluid max width main">
    <divclass="offset cf">
    <div class="<?php x_main_content_class();?>" role="main">
    <?php global $wpdb;
    $args = array('posts_per_page'=>10,'order'=>'DESC','offset'=>$infinite_loop );
    $myposts = get_posts( $args );foreach( $myposts as $post ): setup_postdata( $post ); ?>
    <article id="post-<?php the_ID();?>" <?php post_class();?>>​
    <div>
    <divstyle="width:300px;float:left;">
    <?php x_ethos_featured_index();?>
    </div>
    <divstyle="width:500px;float:right;">
    <?php /* print $args['offset']; */?>
    <?php x_get_view('ethos','_content','post-header');?>
    <?php x_get_view('global','_content');?>
    </div></div></article>
    <?php endforeach;
    wp_reset_postdata();?>
    </div><?php get_sidebar(); ?>
    </div>
    </div>

    AJAX IN THEME HEADER

    <script>
    $(document).ready(function(){

    var post_page_count =10;var height_scroll =400;
    $(window).scroll(function(){

    if($('body').height()<=($(window).height()+ $(window).scrollTop())){
    post_page_count = post_page_count+10;

    $.ajax({
    type:"POST",
    async:false,
    url:"theme/infinite_loop.php",
    data:{pcount: post_page_count},
    success:function(result){


    $("#gizinfi").append(result);
    }
    });
    };
    });
    });
    </script>
    Please help me to find out the solution. If you know anything please help me...

     
    Ramesh8248, Feb 28, 2015 IP
  2. OlgaSeCom

    OlgaSeCom Active Member

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #2
    You need to find an error. Do you have an access to the server logs? (maybe in the hosting control panel)
     
    OlgaSeCom, Mar 3, 2015 IP
  3. Ramesh8248

    Ramesh8248 Active Member

    Messages:
    165
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Yup I have access to the server log, but i haven't found anything there...
     
    Ramesh8248, Mar 3, 2015 IP
  4. OlgaSeCom

    OlgaSeCom Active Member

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #4
    What control panel you are using for the hosting?
     
    OlgaSeCom, Mar 3, 2015 IP
  5. Ramesh8248

    Ramesh8248 Active Member

    Messages:
    165
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #5
    I am Using WebMin...
    I have found that i am getting this error if I used wordpress code


    This that code which is actually responsible for the error:

    <?php require('/home/gizmoids/public_html/wp-blog-header.php'); ?>

    <?php

    global $post;
    $count_posts = wp_count_posts();
    $published_posts = $count_posts->publish;
    $args = array('numberposts' =>$published_posts);
    $myposts = get_posts($args );
    foreach( $myposts as $post ) :
    setup_postdata($post); ?>

    <?php echo get_permalink(); ?>

    <?php echo $queryrows; ?>



    <?php endforeach; ?>​

    That code gives me right output but still showing the error of 404...
    Means if this code is in my listtitle.php then in the console its showing
    "NetworkError: 404 Not Found - http:// mywebsite . c0m/listtitle.php"

    Why? I am getting stuck on this
     
    Ramesh8248, Mar 3, 2015 IP
  6. OlgaSeCom

    OlgaSeCom Active Member

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #6
    You need to find an error logs. Can you check log file /var/log/httpd/error.log ?
     
    OlgaSeCom, Mar 3, 2015 IP
  7. Ramesh8248

    Ramesh8248 Active Member

    Messages:
    165
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #7
    I found the solution

    Thank you for the reply OlgaSeCom
    http://stackoverflow.com/questions/28772374/ajax-post-500-internal-server-error
     
    Ramesh8248, Mar 3, 2015 IP