Title: [Plugin: Shortcode Exec PHP] doesn&#039;t work
Last modified: August 20, 2016

---

# [Plugin: Shortcode Exec PHP] doesn't work

 *  Resolved [gopanthers](https://wordpress.org/support/users/gopanthers/)
 * (@gopanthers)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/)
 * doesn’t work at all. Even the default test code gives parse error.
 * [http://wordpress.org/extend/plugins/shortcode-exec-php/](http://wordpress.org/extend/plugins/shortcode-exec-php/)

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

 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2608990)
 * Could you please post the error message?
 *  Thread Starter [gopanthers](https://wordpress.org/support/users/gopanthers/)
 * (@gopanthers)
 * [14 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609299)
 * I didn’t realize I had tried this plugin before but I just reinstalled it again.
   Same results so I came here for support and found my own post. (This time I’m
   checkmarking the ‘notify me of follow-up posts’)
 * This plugin sounds like a perfect solution for my needs, where I’d like to keep
   the php code out of the pages themselves because other, less-experienced editors
   could mess it up.
 * When I click the test button (and when I add the test shortcode on a page) I 
   get the following message:
 * [php_test]=”
    <b>Parse error</b>: syntax error, unexpected ‘<‘ in <b>/home/xxxmyaccountxxx/
   public_html/xxxmydomainxxx/wp-content/plugins/shortcode-exec-php/shortcode-exec-
   php-class.php(1069) : eval()’d code</b> on line <b>1</b> ”
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609300)
 * This message means that there is a syntax error in your shortcode definition.
 * I can help you with this, but you’ll have to post the shortcode definition.
 *  Thread Starter [gopanthers](https://wordpress.org/support/users/gopanthers/)
 * (@gopanthers)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609301)
 * This is all straight out of the box. At first the shortcode said [test] but thought
   that may conflict with something so I changed it to [php_test]. In both cases
   it didn’t work.
 * As for the code being executed, it is exactly the default.
 * <?
 * <p style=”text-align: center;”>test</p>
 * ?>
 * I haven’t touched any settings.
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609302)
 * That is not the example code out of the box and it is indeed wrong.
    Try it like
   this:
 *     ```
       ?>
       <p style="text-align: center;">test</p>
       <?php
       ```
   
 *  Thread Starter [gopanthers](https://wordpress.org/support/users/gopanthers/)
 * (@gopanthers)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609303)
 * Thanks for the help. All I see different is the ?> and <?php being reversed but
   I tried it anyway and go the same error code. So I then decided to change the
   code to be executed to nothing other than `<b>test</b>` and still got the same
   results. Must not be a problem with the php code trying to be executed by the
   shortcode.
 * `[test3]=”
    <b>Parse error</b>: syntax error, unexpected $end in <b>/home/xxxxx/
   public_html/xxxxx.net/wp-content/plugins/shortcode-exec-php/shortcode-exec-php-
   class.php(1069) : eval()’d code</b> on line <b>1</b> “‘
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609304)
 * It is definitely a problem with the shortcode (because eval()’d code on line 
   1).
 * And `<b>test</b>` is not PHP but HTML, so you must use the closing PHP tag and
   after it the PHP opening tag again.
 * Try this to see that it works:
 * `echo 'Test';`
 * (no PHP opening and closing tags, because this is PHP code).
 * This plugin is not meant for HTML (although it is possible to a certain extend).
 *  Thread Starter [gopanthers](https://wordpress.org/support/users/gopanthers/)
 * (@gopanthers)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609306)
 * Hey, that one worked!!! Thanks!!!
 * So I’ll have to test later with the code I really want to use, but it seems that
   the <? and ?> are not necessary for the php code itself? (The default test code
   that was there did have those characters at the top and bottom so I assumed they
   needed to be there. If that’s not normal than I wonder how that happened on two
   different fresh install.)
 * And if my code has non-php elements in it, I suppose I should just go through
   the effort of changing it to php standards, right?
 * Thanks again.
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609307)
 * > So I’ll have to test later with the code I really want to use, but it seems
   > that the <? and ?> are not necessary for the php code itself?
 * No, these are not necessary.
 * > The default test code that was there did have those characters at the top and
   > bottom so I assumed they needed to be there. If that’s not normal than I wonder
   > how that happened on two different fresh install
 * The default test code does not contain PHP starting and ending tags.
 * The default test code is:
 *     ```
       extract(shortcode_atts(array('arg' => 'default'), $atts));
       echo "Hello world!" . PHP_EOL;
       echo "Arg=" . $arg . PHP_EOL;
       echo "Content=" . $content . PHP_EOL;
       ```
   
 * > And if my code has non-php elements in it, I suppose I should just go through
   > the effort of changing it to php standards, right?
 * Yes, or use PHP closing and opening tags for HTML code.

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

The topic ‘[Plugin: Shortcode Exec PHP] doesn't work’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcode-exec-php.svg)
 * [Shortcode Exec PHP](https://wordpress.org/plugins/shortcode-exec-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-exec-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-exec-php/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-exec-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-exec-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-exec-php/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [M66B](https://wordpress.org/support/users/m66b/)
 * Last activity: [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-doesnt-work/#post-2609307)
 * Status: resolved