Title: Parse error in php-code-widget/execphp.php(27) : eval()&#039;d code on line 4
Last modified: August 21, 2016

---

# Parse error in php-code-widget/execphp.php(27) : eval()'d code on line 4

 *  Resolved [ReactorShop](https://wordpress.org/support/users/reactorshop/)
 * (@reactorshop)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/)
 * I’d really like to thank you for this plugin. It does the job really good.
 * The only issue I have is that I’m currently showing a translation link inside
   a widget, but since the url for this link is http, I can’t load it inside the
   widget without braking the browser padlock.
 * I need to show it when doing http insecure connections, and hide it when the 
   connection is done over SSL.
 * This is what I put inside the PHP code widget:
 *     ```
       <?php if ( is_ssl() ) { esc_html_e( '<a href="http://free-website-translation.com/" id="ftwtranslation_button" hreflang="en" title="" style="border:0;"><img src="http://free-website-translation.com/img/fwt_button_en.gif" id="ftwtranslation_image" alt="FWT Homepage Translator" style="border:0;"/></a> <script type="text/javascript" src="http://free-website-translation.com/scripts/fwt.js" /></script>' ); } else { esc_html_e( 'Translations not available on secure connections.' ); ?>
       ```
   
 * The issue is that every time the widget is loaded, I get the error I posted above,
   and I see that the error occurs when doing the eval.
 * Is there a way to format the above code in order for it to appear when on SSL
   and show the text message when doing an http insecure connection?
 * I’ll appreciate any advice you may provide.
 * [http://wordpress.org/plugins/php-code-widget/](http://wordpress.org/plugins/php-code-widget/)

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

 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/#post-4529988)
 * This really doesn’t have anything to do with the plugin, but I’ll answer your
   question.
 * The link isn’t the problem. Your image and script URLs are. You need to change
   those to either be https all the time, or change them to be protocol-relative
   URLs.
 * However, since “[https://free-website-translation.com/img/fwt_button_en.gif&#8221](https://free-website-translation.com/img/fwt_button_en.gif&#8221);
   doesn’t actually work, you’ll have to copy the image locally and use the local
   URL instead.
 * The padlock breaks when you load HTTP resources on an HTTPS page. If you want
   the padlock to not break, everything on the page must be available through HTTPS.
 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/#post-4529989)
 * Also, the is_ssl() code you’re trying to use works, but it relies on the server
   accurately reporting if the current connection is SSL or not. It checks to see
   if $_SERVER[‘HTTPS’] is set, or if the $_SERVER[‘SERVER_PORT’] is 443 (which 
   is the default https port). If you are using some other different kind of webserver
   than Apache, it may not be accurate for that case.
 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/#post-4529992)
 * … and I just noticed, but you have your logic backwards. You’re outputting the
   link *only* on SSL connections. is_ssl() returns true on SSL connections.
 * Try reversing the order of your two pieces of code there. 🙂
 *  Thread Starter [ReactorShop](https://wordpress.org/support/users/reactorshop/)
 * (@reactorshop)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/#post-4530038)
 * Got it. I was missing the last closing curly brace.
 * Thank you for the heads up with the is_ssl() function. I’m switching my website
   from port 80 to port 443 and back depending if the page displayed requires user
   input or not (for now I’m doing this in my testing environment). The production
   server and my testing environment run Apache.
 * I can’t change that script because it’s not hosted in my website and as you noticed,
   that translation website doesn’t support ssl connections. That’s why I’m excluding
   it from my HTTPS pages.
 * Thank you for your help.

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

The topic ‘Parse error in php-code-widget/execphp.php(27) : eval()'d code on line
4’ is closed to new replies.

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [ReactorShop](https://wordpress.org/support/users/reactorshop/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-in-php-code-widgetexecphpphp27-evald-code-on-line-4/#post-4530038)
 * Status: resolved