The plugin says I’m missing something

The EWWW Image Optimizer uses jpegtran, optipng, gifsicle, pngout, pngquant, and cwebp. Odds are, most of these won’t be installed on your server, so EWWW I.O. comes bundled with binaries (executables) that work on most platforms. But sometimes they don’t because the Linux landscape is quite diverse, and some webhosts will even build their own custom distributions of linux. The source code is not available for Pngout, so the only way to install it is via the links on the settings page. For everything else, keep reading.

So what do you do?

The first question you need to answer is “how much access do you have to your server?” Do you have command line (shell) access? If so, do you have root access? If you don’t know if you have root access, then you don’t. If you’re on a dedicated server or VPS, then you should have root access, but sometimes a VPS is really just a shared server with guaranteed resources. If you are on a shared server, then you do not have root access…ever.
If you don’t have root access, and don’t even have shell/ssh access, then you will need to ask your webhost to install the utilities for you. Some smaller hosts may be willing to do this, most large hosts will not even think twice before telling you NO. If you find yourself in that position, you are exactly why I created the  EWWW I.O. Cloud service (unless you want to switch web hosts). If you DO have shell access, but not root access, you may be able to build the necessary binaries for your server. This may be a bit intimidating if it is the first time you’ve ever done this, but I’ll walk you through it step by step.

Can I build it?

First, you need to find out if you have build (compiling) utilities available. There are a few commands that will give you some hints, so try these:
ldconfig -p | grep libjpeg
gcc -v
make -v
If any of those says something like “command not found”, then you won’t be able to build anything, and you are in the same boat as the folks with no shell access. The good news is that I built the EWWW I.O. Cloud service for you too (again, unless you want to switch web hosts).

Yes I Can!

At least we think so, time will tell. It should be noted, that if you have root access, you could install a few of theses utilities yourself from the normal repositories. However, I don’t recommend that for most of the utilities except jpegtran, and possibly optipng. The versions that are generally provided are often out of date, and some (like cwebp and pngquant) are under pretty active development, so bug fixes and new features are coming out much more frequently. As the root user, that is up to you though. If you prefer the pre-built versions from the repositories, something like “apt-get install gifsicle” or “yum install gifsicle” will get you going. If you are not the root user, or you would like to have the latest versions installed, read on!

1. Download the source package from the project’s website:

You can download these however you like, but I generally use wget like so:
wget <a href="http://www.lcdf.org/gifsicle/gifsicle-1.88.tar.gz">http://www.lcdf.org/gifsicle/gifsicle-1.88.tar.gz</a>
Optipng is a little tricky to get the direct url since it is hosted on Sourceforge, but you should end up with a download url like this: http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.6/optipng-0.7.6.tar.gz (just strip off all the junk at the end if you copy the Direct Link that Sourceforge gives you).

2. Unpack/extract the tarball:

For those of you unfamiliar with the term tarball, take a look at the file extensions of the two files I mentioned above. They both have double extensions at the end, one of which is .tar, thus the term tarball. Tar is an alternative to zip which is very common in the Unix/Linux world. The second extension tells you what kind of compression has been used after the tarball was created. To extract a tarball, the compression used is important, because it means you’ll be using different options for the tar command. Here are a few examples:
tar xvzf gifsicle-1.88.tar.gz<br>tar xvzf optipng-0.7.5.tar.gz<br>tar xvjf pngquant-2.5.2-src.tar.bz
x = extract
v = verbose (you can skip this, but I like to see what the command did)
z = gzip compression, usually when the extension is .tar.gz or .tgz
j = bzip2 compression, when the extension is .bz or .bzip2
f = file, or in other words “use the file listed after this option”
Naturally, options ‘j’ and ‘z’ are mutually exclusive, but the others will generally remain the same. If you were to download a .zip file from any of the sites above, you just do ‘unzip put-the-filename-here.zip’

3. Configure the build

This is a nice short step (usually) unless you’re missing dependencies. Optipng and Pngquant both depend on libpng-dev or libpng-devel. Libwebp (cwebp) requires the libjpeg and libpng development files. If you don’t have these installed, the package names are usually something like libjpeg-dev and libpng-dev. For the most part, you can just navigate into the folder extracted from the tarball, and run the configure script, like this:
cd optipng-0.7.5/<br>./configure
If you’re compiling jpegtran on a shared server where you don’t have root access, you need to add ‘ –disable-shared’ after the configure command like so:
./configure --disable-shared
It should spew out a whole bunch of output, and so long as you don’t see any errors, you can move on to the next step. When compiling libwebp, make sure JPG and PNG both say ‘yes’ under Input format support.

4. Build it

This is the part where the code is actually compiled into a machine-readable binary file, and it is one simple command, with no options:
make
It will output even more during this step usually, and again, if there are no errors, you’re ready for the last step.

5. Install the binary

The last step depends on whether or not you have root access to the server. If you’re on shared hosting, remember the answer is already no. If you have root access, become root by using the su or sudo commands and run the installation:
make install
You can combine the sudo command with the install command if sudo is installed and configured on your system:
sudo make install
If you do NOT have root access like it would be on a shared server, you can copy the binary to the wp-content/ewww/ folder. First, you have to know where the binary is that we created in step 4. Jpegtran and Pngquant put the binaries in the root of the source folder, for the others the relative paths to the source folders are like so:
optipng: src/optipng
gifsicle: src/
cwebp: examples/
EWWW I.O. won’t like it if you replace the built-in binaries in the wp-content/ewww/ folder, but it will work just fine if you append -custom to the filename, something like this:
cp src/optipng/optipng /path-to-your-wordpress-folder/wp-content/ewww/optipng-custom
Of course, substitute ‘path-to-your-wordpress-folder’ as appropriate for your server. You can find this folder directly above the Folders to optimize setting on the EWWW I.O. Advanced settings tab.

6. Checking the binaries

Once you’ve installed the binaries, or copied them to the ewww/ folder, you can go back to the EWWW I.O. Settings page to see if it has been detected properly. Once the plugin detects the previously missing binary, you’re ready to start optimizing. Feedback and comments are welcome.

Still need help? Contact Us Contact Us