Title: php error
Last modified: August 19, 2016

---

# php error

 *  Resolved [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/)
 * Hi there!
    got PHP Parse error: syntax error, unexpected T_ENDWHILE in /srv/vhosts/
   www.mydomain.com/htdocs/wordpress/wp-content/themes/p2.1.0.1/p2/functions.php
   on line 729, referer: [http://www.mydomain.com/wordpress/wp-admin/themes.php](http://www.mydomain.com/wordpress/wp-admin/themes.php)
   when trying to preview this theme. Same error if I apply p2 to my website. Any
   ideas? thanks, have a nice day

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

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049782)
 * It seems likely that is a coding error in the p2 theme’s functions.php file. 
   It’s saying there is an endwhile statement in the wrong place. It often means
   the error is above that statement – it encountered the endwhile by falling through
   out of some unclosed If block for example.
 * If you can’t find it, if you post the contents of functions.php in a pastebin
   someone can help you locate the error.
    [http://wordpress.pastebin.ca/](http://wordpress.pastebin.ca/)
 *  Thread Starter [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049794)
 * here it is 🙂
 * [http://wordpress.pastebin.ca/1391885](http://wordpress.pastebin.ca/1391885)
 * it’s the default functions.php in p2 theme downloaded in the theme’s directory.
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049798)
 * Hi
 * Line 1181 of that code is missing a closing PHP tag
 * What is there
 *     ```
       <?php
       }
       ```
   
 * What needs to be there
 *     ```
       <?php
       } ?>
       ```
   
 * I haven’t run the code – my syntax error checker found that. Give it a try and
   see if it resolves the problem.
 * If it does, double check with the theme file you downloaded – if it is missing
   in the original file, let the theme author know so it can be corrected. It seems
   likely though that somehow it was removed in your installation only, as this 
   would happen to everyone if it was in the distributed theme code.
 *  [emsltek](https://wordpress.org/support/users/emsltek/)
 * (@emsltek)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049803)
 * I am having the same problem on my self-hosted WP, running on WAMP. I tried adding
   the closing PHP tag, per stvwlf’s post. When added, the same error occurs, but
   on line 730.
 * I’m thinking the problem is not an absent closing PHP tag.
 * WP 2.7.1
    MySQL 5.0.18 PHP 5.1.2
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049857)
 * Hi
 * I’m not running the code and I don’t see exactly what is going wrong. If you 
   are both having this error in the same place, it is likely a bug in the theme
   code.
 *  [noel](https://wordpress.org/support/users/noel/)
 * (@noel)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049882)
 * Thanks for the notice. I’ll take a look and figure out what is going on.
 *  Thread Starter [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049917)
 * happened with every svn I tried these days, at the same point
    let us know 🙂
 *  [photogold](https://wordpress.org/support/users/photogold/)
 * (@photogold)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049923)
 * just installed P2 . My website has disappeared [http://www.photogold.co.uk](http://www.photogold.co.uk)
   .
   Error message “Fatal error: Cannot redeclare class Services_JSON in /home/322/
   first121/www.photogold.co.uk/public_html/wp-content/themes/p2/inc/JSON.php on
   line 116” what is wrong ?
 *  Thread Starter [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1049999)
 * problem persist even in 1.0.3
 * PHP Parse error: syntax error, unexpected T_ENDWHILE in /srv/vhosts/www.mydomain.
   com/htdocs/wordpress/wp-content/themes/p2103/functions.php on line 729, referer:
   [http://www.mydomain.com/wordpress/wp-admin/themes.php](http://www.mydomain.com/wordpress/wp-admin/themes.php)
 * Noel, any news?
 *  [noel](https://wordpress.org/support/users/noel/)
 * (@noel)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1050003)
 * [@ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/) Could you
   send me more specific information regarding your problem? php version other plugins
   you’re running and perhaps any other errors that are showing up around there?
 *  Thread Starter [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1050010)
 * sure 🙂
 * When I try to preview the theme, It happens. The preview shows me a blank page.
   If I try to apply the theme to my site, gives me the same error on the error.
   log I already posted (internal server error in IE).
 * WP 2.7.1
    Web server: Apache/2.2.4 (Linux/SUSE) MySQL: 5.0.45 PHP Version 5.2.6
 * Plugins: Akismet, Facebook Connector, Google Analytics for WordPress, Google 
   XML Sitemaps, Sort by Comments, Whydowork Adsense, WordPress Database Backup,
   WP Recent Tags, WP Super Cache.
 * Could it be related to [http://wordpress.org/support/topic/255088#post-1047539](http://wordpress.org/support/topic/255088#post-1047539)?
 *  Thread Starter [ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
 * (@ghoulsnghosts)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1050014)
 * with the fix n. 1 at [http://wordpress.org/support/topic/255088](http://wordpress.org/support/topic/255088)
   everything worked fine 🙂
 *  [emsltek](https://wordpress.org/support/users/emsltek/)
 * (@emsltek)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-error-5/#post-1050022)
 * Fix worked for me as well. Thanks [@ghoulsnghosts](https://wordpress.org/support/users/ghoulsnghosts/)
   for the pointer and thanks to [@lilyfan](https://wordpress.org/support/users/lilyfan/)
   for the solution.
 * Here is [@lilyfan](https://wordpress.org/support/users/lilyfan/)’s fix that worked
   for me (from [http://wordpress.org/support/topic/255088](http://wordpress.org/support/topic/255088)):
 * > (1) There are two shorthand PHP tags. Because my server is “short_open_tag 
   > = Off”, a PHP parse error was occur.
   > The fix point is below.
   > * line 429 of functions.php
   >  <div class=”postcontent<?php if (current_user_can(‘
   > edit_post’, get_the_id() )) {?> editarea<?}?>”….
   > should be:
   >  <div class=”postcontent<?php if (current_user_can( ‘edit_post’,
   > get_the_id() )) {?> editarea<?php } ?>”
   > * line 27 of entry.php
   >  <div class=”postcontent<?php if (current_user_can( ‘
   > edit_post’, get_the_id() )) {?> editarea<?}?>”… shoud be: `<div class=”postcontent
   > <?php if (current_user_can( ‘edit_post’, get_the_id() )) {?> editarea<?php }?
   > >”
 *  [noel](https://wordpress.org/support/users/noel/)
 * (@noel)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/php-error-5/#post-1050076)
 * The newest version of P2 fixes all of these issues.

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

The topic ‘php error’ is closed to new replies.

## Tags

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

 * 14 replies
 * 5 participants
 * Last reply from: [noel](https://wordpress.org/support/users/noel/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/php-error-5/#post-1050076)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
