Title: Parse error: syntax error, unexpected $end in index.php
Last modified: August 20, 2016

---

# Parse error: syntax error, unexpected $end in index.php

 *  [MortimerOnline](https://wordpress.org/support/users/mortimeronline/)
 * (@mortimeronline)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/)
 * Hello everyone,
 * I have a woking installation of WordPress 3.5.1. I hired a PSD 2 WP service to
   slice a theme. It works like a charm in their WordPress installation, but when
   I upload it to my instalation, I get the error “Parse error: syntax error, unexpected
   $end in index.php” in the last line of the file. I believe it’s not a code error
   in the theme itself, since as I say it works in their WordPress.
 * To install this theme I’ve uploaded the theme into /themes directory, their plugins
   in /plugins directory and their XML database export was successfuly imported 
   into my database.
 * If I switch themes, it works fine.
 * There is another error I get as well: Notice: add_custom_background está obsoleto
   desde la versión 3.4. Utiliza add_theme_support( ‘custom-background’, $args )
   en su lugar. in ……\Blog\wp-includes\functions.php on line 2839
 * Any suggestions on where to start debugging?
 * Thanks a lot for your time!

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509815)
 * > If I switch themes, it works fine.
 * Then the issue is in the theme. From the second error/warning, it also appears
   your theme creators are not developing themes suitable for WordPress 3.5
 *  Thread Starter [MortimerOnline](https://wordpress.org/support/users/mortimeronline/)
 * (@mortimeronline)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509816)
 * Thanks for your reply, esmi.
 * However, I’ve checked the headers on their site and it says
    <meta name=”generator”
   content=”WordPress 3.5.1″ /> And again, the theme works fine in their server.
   So I assume there must be something in my instalation that is not compatible 
   with their theme, and it’s causing a conflict (maybe an option in functions.php?)
 * So any help on where to start checking out stuff would be much appreciated indeed.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509824)
 * > I’ve checked the headers on their site and it says
   >  <meta name=”generator” 
   > content=”WordPress 3.5.1″ />
 * Nevertheless, the theme may not have been built in line with wordpress.org standards.
   And a parse error is a clear indication of a serious issue in a file – not any
   kind of conflict. It might help if you posted the full error message.
 *  Thread Starter [MortimerOnline](https://wordpress.org/support/users/mortimeronline/)
 * (@mortimeronline)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509835)
 * Thanks again for your reply.
 * This is the full message:
 * Notice: add_custom_background está obsoleto desde la versión 3.4. Utiliza add_theme_support(‘
   custom-background’, $args ) en su lugar. in C:\(…)\Blog\wp-includes\functions.
   php on line 2839 Notice: add_custom_image_header está obsoleto desde la versión
   3.4. Utiliza add_theme_support( ‘custom-header’, $args ) en su lugar. in C:\(…)\
   Blog\wp-includes\functions.php on line 2839 Parse error: syntax error, unexpected
   $end in C:\(…)\Blog\wp-content\themes\sureserviceser\index.php on line 76
 * Line 76 is the end of the index.php file.
 * If I set functions.php to not display error messages, I get a 500 error.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509838)
 * The problem is **definitely** in the theme. Specifically its index.php file. 
   You need to go back to the suppliers with these issues.
 *  Thread Starter [MortimerOnline](https://wordpress.org/support/users/mortimeronline/)
 * (@mortimeronline)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509842)
 * All right then… thanks a lot. Unfortunately I think they gave up. 🙁 They won’t
   answer back my messages. And they are in India, so I can’t go there and kill 
   them.
 * However, I must say I commented the whole index.php file just to see where the
   problem started, and it still showed the same problem. 😐
 * Oh well, I’ll go on with the investigation and if I find the problem, I will 
   let ya know all.
 *  Thread Starter [MortimerOnline](https://wordpress.org/support/users/mortimeronline/)
 * (@mortimeronline)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509906)
 * Hello again!
 * The problem seems to be here. Any suggestions? Tx! 🙂
 *     ```
       <?php query_posts('category_name=sure-service&showposts=2');
       							if ( have_posts() ) : while ( have_posts() ) : the_post();
       							?>
       								<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
       								<div class="est_text">
       								<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
       								<? if(has_post_thumbnail()) { ?>
       									<img src="<?php echo $image[0]; ?>" alt="" width="76" height="76"/>
       									<? } else { ?>
       										&nbsp;
       									<? } ?>
       								<? ob_start();
       								the_content();
       								$content = ob_get_clean();
       								echo substr($content,0,250); ?>
       								</div>
       								<?
       								endwhile; else:
       								endif;
       								wp_reset_query(); ?>
       							</div>
       						</div>
       ```
   
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3509931)
 * Try changing every reference to `<?` to `<?php`. I’d also question this code:
 *     ```
       <? ob_start();
       the_content();
       $content = ob_get_clean();
       echo substr($content,0,250); ?>
       ```
   
 *  [preyas](https://wordpress.org/support/users/preyas/)
 * (@preyas)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3510077)
 * Parse error: syntax error, unexpected $end in /home/sbsson/public_html/preyas/
   wp-config.php on line 1.
    i face this error from last 2 weeks. if you have any
   solution about this error please send me on my email id _[email address moderated–
   these forums do not provide support via email] _
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3510078)
 * **[@preyas](https://wordpress.org/support/users/preyas/)**: As per the [Forum Welcome](http://codex.wordpress.org/Forum_Welcome#Where_To_Post),
   please [post your own topic](http://wordpress.org/support/forum/how-to-and-troubleshooting#postform)–
   including a link to your site. As it stands, your site may have been hacked.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Parse error: syntax error, unexpected $end in index.php’ is closed to
new replies.

## Tags

 * [error 500](https://wordpress.org/support/topic-tag/error-500/)
 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)
 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)

 * 10 replies
 * 3 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-indexphp/#post-3510078)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
