Exif_read_data function does not exist

Hi

I’m running PHP7.1.4 and getting an error when using the exif_read_data function as it doesn’t exist.

Is there any way to enable or add this function?

It’s required for this plugin: https://wordpress.org/plugins/ios-images-fixer/

Thanks
Simon

Hey Simon,

I’m using PHP 7.1.7 on Local by Flywheel. I created this site by simply using the defaults given by the app, and this version includes ImageMagick already configured for use with PHP, saving you a fair amount of work. I’d strongly suggest moving to the newer version of their server environment.

Anyway, if you do, it might help you to know the steps I went through to get the iOS Images Fixer plugin working:

  1. Right-click your site, select Open Site SSH to get a root shell prompt where you can work. Change to root’s home directory, /root so you don’t dump files randomly into the top level of the filesystem.

    cd /root

  2. Update the list of available software packages and install build tools and wget.

    apt-get update && apt-get install -y build-essential autoconf pkg-config wget

  3. Download the source code for your version of PHP - mine was 7.1.7. Extract the files from the archive and change to the directory where the exif plugin source code lives.

    wget http://museum.php.net/php7/php-7.1.7.tar.gz
    tar zxf php-7.1.7.tar.gz
    cd php-7.1.7/ext/exif

  4. Run phpize to set things up for compiling the source. Then configure the build, compile the exif shared library and install it where it belongs.

    /opt/php/7.1.7/bin/phpize
    ./configure --enable-exif=shared --with-php-config=/opt/php/7.1.7/bin/php-config
    make
    make install

  5. Edit the php.ini file

    nano /conf/php/7.1.7/php.ini

  6. Look for the line that says [exif] on it. Insert this line after the [exif] line:

    extension = /opt/php/7.1.7/lib/php/extensions/no-debug-non-zts-20160303/exif.so

  7. Use CTRL-W to save the file. Just hit enter when it gives you the opportunity to change the name. CTRL-X will quite the nano editor and take you back to a prompt.

  8. Hit the “Stop Site” button in the Local by Flywheel window. When the site shuts down completely, start it back up. Your iOS Images Fixer plugin ought to work now.

Hope this is helpful to you,

Brandon

4 Likes

Hi Brandon - thanks for the detailed reply!

Because I’m using a custom environment it doesn’t give me the option to switch to 7.1.7 unfortunately. I see that there is a new version imminent with PHP7.2 (which is what I’m running in production), so I’ll wait for that and see if it has ImageMagick included. If not, I’ll follow your instructions.

Hey Simon,

To switch to the Preferred environment you can export the current site using Custom from Local and then re-import. When re-importing, simply select “Preferred” on the Environment page and you should be good to go.

PHP 7.2.0 in Custom doesn’t come with ImageMagick at this time.

1 Like

Ah that’s handy to know, I wasn’t aware of that.

Just out of interest, is there a reason ImageMagick is not included?

Right now it’s a limitation of the base image that the Custom environment uses.

We’ll absolutely be adding support for it in Custom in the future.

1 Like

Thank you very much. It worked!

Hi Brandon.

Just confirming that this worked for me as well on the Preferred Local Environment (PHP 7.1.7).

I was getting a warning from the Ultimate Member plugin regarding enabling Exif on the server and that has now disappeared.

Thank you,
David