In this example i will show how to install libvpx and compile php with vpx for webp support in php.

First we need to install the libraries from distros package repository.

yum install libvpx.x86_64 libvpx-devel.x86_64

Then we enter cPanels folder for custom options for easyapache.

cd /var/cpanel/easy/apache/rawopts

Then we need to make a file to add the options to, in this example we call it all_php5

nano all_php5

Then append the following text to file.

--with-vpx-dir

And now you can just recompile apache / php with easyapache and our cusom option will be compiled.

If you get any errors while running easyapache after adding a custom option like this its probably linked to missing library or not supported option for your version of php.
Check documentation on php.net.