Title: PHP 5.4
Last modified: August 20, 2016

---

# PHP 5.4

 *  [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/)
 * Hi Guys,
 * Firstly, thanks for this wonderful plugin which has solved the recent Google 
   images upgrade for us. I have 2 questions however:
 * 1) Our server is hosted with 1&1 who are currently in the process of upgrading
   to PHP 5.4. When we add the line AddHandler x-mapp-php6 .php in to our .htaccess
   file, it breaks your plugin. Is there a way we can solve this having both that
   line of code in and having your plugin working?
 * 2) We have various systems that pull in images from HeyUGuys like Facebook and
   Pinterest. I’ve tried adding what looks like their image CDN to the whitelist
   but the ‘click to view’ still appears. Is there a way round this and can you 
   use wildcards in there? e.g. assets*.pinimg.com
 * Facebook example is here: [https://www.facebook.com/heyuguys](https://www.facebook.com/heyuguys)
   and the site in question on which I run is [http://www.heyuguys.co.uk](http://www.heyuguys.co.uk).
 * Thanks again.
 * Dave
 * [http://wordpress.org/extend/plugins/imaguard/](http://wordpress.org/extend/plugins/imaguard/)

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

 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491623)
 * Hi there!
 * Re question 1: Could you either post some more details or send us an email with
   the exact htaccess and the error messages received? I will look into it to see
   if we can solve it.
 * Re question 2: You should find referrer details in your log files. Test by adding
   an image and see what hits you get in the logs and just whitelist those.
 * We are considering adding the option to blacklist instead of whitelist to the
   next version. Meanwhile you can easily reverse the whitelist to a blacklist in
   your .htaccess file in WP root folder. Simply remove the ! indicating “not”. 
   This is what you should have now:
 *     ```
       # BEGIN imaguard
       RewriteEngine on
       RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yoursite\.com [NC]
       RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ /show-image/?img=/$1.$2 [R=301,NC,L]
       # END imaguard
       ```
   
 * Here yoursite is being whitelisted (it’s saying on condition NOT yoursite, then
   rewrite and enable Imaguard. Just change it to:
 *     ```
       # BEGIN imaguard
       RewriteEngine on
       RewriteCond %{HTTP_REFERER} ^http://(.+\.)?badsite\.com [NC]
       RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ /show-image/?img=/$1.$2 [R=301,NC,L]
       # END imaguard
       ```
   
 * And you have reversed it to On condiotion badsite then activate Imaguard.
 * Just remember that if you update Imaguard (settings or version) it will overwrite
   your changes, so keep a backup of your htaccessfile.
 * Hope this helped!
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491624)
 * Awesome, thanks.
 * So all I add to .htaccess for question one is the line:
 * AddHandler x-mapp-php6 .php
 * This then causes all images with overlay to have the error:
 * The Image Cannot Be Displayed, [http://XXXX.jpg](http://XXXX.jpg) Because It 
   Contains Errors.
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491626)
 * p.s. just having a play with the code above and am struggling to get it working,
   mainly because this might as well be Greek to me! But if the domain i want the
   images to have the overlay on is: [http://images.google.com](http://images.google.com),
   what would the code above be?
 * D
 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491631)
 * Are you logged into google when testing? Google has recently started sending 
   empty referers more and more often when someone is logged in to google. Another
   reason to use a whitelist instead of a blacklist.
 * You can of course block empty referrers but that may cause problems with search
   engines crawling your site. As an experiment, try:
 *     ```
       # BEGIN imaguard
       RewriteEngine on
       RewriteCond %{HTTP_USER_AGENT} ^-?$
       RewriteCond %{HTTP_REFERER} ^https?://(.+\.)?google\.com [NC]
       RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ /show-image/?img=/$1.$2 [R=301,NC,L]
       # END imaguard
       ```
   
 * Might as I said cause crawler issues, but worth testing it out to see if you 
   can get it to work.
 * If you have cPanel installed, you can usually click on “latest visitors” test
   to open an image via google and check what referrer is set (you don’t need cpanel
   to do this, but it has an easy link and then you just click refresh after the
   test to see what referrer was set.
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491632)
 * I think the main problem I have is that I want some subdomains to work and others
   not to.
 * e.g. I want images.google.com to display the overlay, but mail.google.com not
   to. At the moment if you add a subdomain, it’ll include the main domain in the.
   htaccess file e.g. google.com which encompasses all of Google’s subdomains.
 * D
 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491639)
 * Hi again,
 * Something like
 * `http(s)?://(.+\.)?google\.com`
 * would match [http://google.com](http://google.com), [http://www.google.com](http://www.google.com),
   [https://google.com](https://google.com) and [https://www.google.com](https://www.google.com).
   If you just want it to match specific subdomains, simply type the entire domain:
 * `http(s)?://images\.google\.com`
 * This would match [https://images.google.com](https://images.google.com) and [http://images.google.com](http://images.google.com).
 * For more referrer domains, simply add more lines:
 *     ```
       # BEGIN imaguard
       RewriteEngine on
       RewriteCond %{HTTP_USER_AGENT} ^-?$
       RewriteCond %{HTTP_REFERER} ^http(s)?://images\.google\.com [NC]
       RewriteCond %{HTTP_REFERER} ^http(s)?://groups\.google\.com [NC]
       RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ /show-image/?img=/$1.$2 [R=301,NC,L]
       # END imaguard
       ```
   
 * However, as I said Google is cheating more and more by simply sending an empty
   referrer. To catch those you must use ^-?$:
 *     ```
       # BEGIN imaguard
       RewriteEngine on
       RewriteCond %{HTTP_USER_AGENT} ^-?$
       RewriteCond %{HTTP_REFERER} ^http(s)?://images\.google\.com [NC]
       RewriteCond %{HTTP_REFERER} ^http(s)?://groups\.google\.com [NC]
       RewriteCond %{HTTP_REFERER} ^-?$ [NC]
       RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ /show-image/?img=/$1.$2 [R=301,NC,L]
       # END imaguard
       ```
   
 * But as I said, this may impact how your site is crawled.
 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491640)
 * Forgot to comment re php 5.4. Could you confirm that your host has bundles the
   GD lib with the php 5.4 install? It’s required by Imaguard.
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491641)
 * Thanks again for all your help on this.
 * I don’t know about the GD lib. Host is 1&1 if that helps. They’re pretty darn
   useless!!
 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491642)
 * They don’t have any info on the GD lib with php 5.4. What you can do is to create
   a new php file and just put this in it:
 * `<?php phpinfo (); ?>`
 * Is you save that as f ex yourdomain.com/test.php it will show you a list of installed
   libraries when you run it. You should have a section called GD and under that
   an entry called GD Version.
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491643)
 * This is what I get:
 *     ```
       gd
       GD Support 	enabled
       GD Version 	bundled (2.0.34 compatible)
       FreeType Support 	enabled
       FreeType Linkage 	with freetype
       FreeType Version 	2.4.2
       GIF Read Support 	enabled
       GIF Create Support 	enabled
       JPG Support 	enabled
       PNG Support 	enabled
       WBMP Support 	enabled
       XBM Support 	enabled
       ```
   
 *  Plugin Author [imaguard](https://wordpress.org/support/users/imaguard/)
 * (@imaguard)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491644)
 * Ok, that’s not the issue then.
 * When you have time you can try to stick the line
 * `error_reporting(E_ALL);`
 * into wp-content/plugins/imaguard/index.php in ir_detectpost function like this:
 *     ```
       function ir_detectpost($posts) {
       	error_reporting(E_ALL);
   
       	global $wp;
       	global $wp_query;
       ```
   
 * Hopefully it will show a php error when you try to open the image again – not
   just the general “contains errors” error.
 *  Thread Starter [daveszt](https://wordpress.org/support/users/daveszt/)
 * (@daveszt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491674)
 * OK, tried that and it brings up dozens of errors across the site but when I try
   the ?test it still comes up with that same error. I’ve had to turn it off for
   now as this is the live site we’re playing with.

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

The topic ‘PHP 5.4’ is closed to new replies.

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

## Tags

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

 * 12 replies
 * 2 participants
 * Last reply from: [daveszt](https://wordpress.org/support/users/daveszt/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/php-54-55/#post-3491674)
 * Status: not resolved