Title: PHP code stopped rendering properly
Last modified: August 20, 2016

---

# PHP code stopped rendering properly

 *  [bobwp](https://wordpress.org/support/users/bobwp/)
 * (@bobwp)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/)
 * A page that been rendering properly, but now isn’t. When I place the source in
   a file outside of WP, it renders properly.
 * — SOURCE:
 *     ```
       Thanks.
   
       <?php
   
       $ip = getenv(REMOTE_ADDR);
       $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
       $ipAddress = gethostbyname($_SERVER['SERVER_NAME']);
   
       print ('<font size="5" COLOR="#DC143C">Your IP address is: '.$ip.'.<p>Your host name is: '.$hostname.'.<p></font>');
   
       ?>
       ```
   
 * –OUTPUT:
 * Thanks
 * $ip = getenv(REMOTE_ADDR);
    $hostname = gethostbyaddr($_SERVER[‘REMOTE_ADDR’]);
   $ipAddress = gethostbyname($_SERVER[‘SERVER_NAME’]);
 * print (‘Your IP address is: ‘.$ip.’.
 * Your host name is: ‘.$hostname.’.
 * ‘);
 * ?>

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

 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281520)
 * Your PHP looks good and as you say, it works outside of WordPress, so that’s 
   probably not the issue.
 * When you say “a page” are you saying you had the PHP directly in the source code
   for a page in WordPress (which won’t work by itself), or did you have it in a
   custom template that a page was based on?
 * Did you change anything between the time it was rendering properly and when I
   quit rendering?
 * Are you getting any PHP errors?
 *  Thread Starter [bobwp](https://wordpress.org/support/users/bobwp/)
 * (@bobwp)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281525)
 * The code in a Page in WP itself. It worked before, and I’m nearly certain I hadn’t
   modified it .
 * I get no PHP error in a browser; do you mean a PHP error in a WP or server log?
 * I wasn’t aware PHP doesn’t work in WP pages.
 * Thanks much for your reply.
 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281528)
 * As far as I know, you can’t run PHP directly by putting it in the editor of a
   Page, you would need to [create a custom template](http://codex.wordpress.org/Pages#Page_Templates),
   put the code in it, then set the Page to that template. It’s actually a security
   feature; you wouldn’t want any contributor or editor to be able to execute PHP
   on your site.
 *  Thread Starter [bobwp](https://wordpress.org/support/users/bobwp/)
 * (@bobwp)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281530)
 * If I can’t use PHP in a default WP Page, I’ll have to rethink my strategy. My
   pages don’t allow commenting, but I could understand why WP might disallow PHP
   code in regular Pages, if doing so is a potential security opening.
 *  Thread Starter [bobwp](https://wordpress.org/support/users/bobwp/)
 * (@bobwp)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281575)
 * I was reviewing my WP maintenance notes, and discovered I had previously installed
   a plugin: “Exec-PHP”. I apparently had deleted it at some point. I reinstalled,
   and all is well now. Sorry for not catching that earlier.
 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281576)
 * That would do it. 🙂

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

The topic ‘PHP code stopped rendering properly’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/php-code-stopped-rendering-properly/#post-3281576)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
