How to Install IonCube Loader on Mac OSX using Homebrew

When I want to run an IonCube encrypted project on my osx, I realized that I didn’t have IonCube Loader installed. Because my PHP is installed using homebrew, I’m going to do the same way for IonCube Loader.

Check PHP Version

It is very important step so we’ll know which version of IonCube Loader to be installed

$ php -v
PHP 5.6.14 (cli) (built: Oct 11 2015 07:19:58)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

My PHP version is 5.6 so I’m going to check whether homebrew has IonCube Loader for PHP 5.6

Check IonCube Loader Availability

$ brew search ioncube
homebrew/php/php53-ioncubeloader
homebrew/php/php54-ioncubeloader
homebrew/php/php55-ioncubeloader
homebrew/php/php56-ioncubeloader

We can see that there is availability for PHP 5.6.

Install IonCube Loader

$ brew install homebrew/php/php56-ioncubeloader

Restart Server

Restart server first to reflect the changes

$ sudo apachectl restart

Check IonCube Loader Installation

We can check if the installation is successful using php -v. We can see that there is an added information about ionCube version.

$ php -v
PHP 5.6.14 (cli) (built: Oct 11 2015 07:19:58)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with the ionCube PHP Loader v5.0.17, Copyright (c) 2002-2015, by ionCube Ltd.

That’s all. It is easy, isn’t it?

  • Jaba

    Hello. I successfully installed IonCube for 7 version of PHP.

    $ brew search ioncube
    homebrew/php/php53-ioncubeloader homebrew/php/php56-ioncubeloader
    homebrew/php/php54-ioncubeloader homebrew/php/php70-ioncubeloader ✔
    homebrew/php/php55-ioncubeloader

    But when i’m checking PHP version i get another version of ionCube.

    $ php -v
    PHP 7.0.14 (cli) (built: Dec 8 2016 23:34:17) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with the ionCube PHP Loader v6.0.8, Copyright (c) 2002-2016, by ionCube Ltd.

    And in my localhost website i have error that says: “…requires the ionCube PHP Loader ioncube_loader_dar_7.0.so…”.
    What could be the reason?

    • deerawan

      Here is mine using PHP 7 and IonCube

      PHP 7.0.14 (cli) (built: Dec 12 2016 16:15:50) ( NTS )
      Copyright (c) 1997-2016 The PHP Group
      Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
      with the ionCube PHP Loader v6.0.6, Copyright (c) 2002-2016, by ionCube Ltd.

      Two things that need to check:
      Have you restarted the apache?
      Can you see ioncube in phpinfo?

      • Jaba

        Thank you for your reply.

        Yes, I have restarted apache.
        Phpinfo() not displaying ioncube and now I realized that it is shows PHP Version 7.0.12. But whet I run “php -v” in terminal.app it displays PHP 7.0.14 and ionCube PHP Loader v6.0.8.

      • Jaba

        I found the reason why php-v and phpinfo.php display different versions. It was because of the installation of Homebrew. Phpinfo has route /usr/local/php5/bin (php5 here is the permalink for folder php5-7.0.12-20161101-102255 in the same catalogue). And version 7.0.14 is in /usr/local/Cellar/php70/7.0.14_7.

        As I’ve understood, Homebrew installed all in folder Cellar. There is also catalogue with ioncube (/usr/local/Cellar/php70-ioncubeloader/6.0.8) there.

        If I delete Homebrew then folder Celler also deletes. And if I install Homebrew again, it creates folder /Cellar and create there /php70/7.0.14_7.

        I have edited .bash_profile by adding export PATH=”/usr/local/php5/bin:$PATH”. After that php -v and phpinfo.php display PHP 7.0.12. B I still don’t have ioncube

        • deerawan

          ideally, we must set Apache to refer PHP that we install via homebrew (the /Cellar one).

          Did you add LoadModule for PHP 7 in httpd.conf of Apache?

  • rich4321

    Hi, I tried i got this error how to fix it?

    Error: You must `brew link xz libpng freetype jpeg unixodbc` before homebrew/php/php56-ioncubeloader can be installed

    • deerawan

      Hi rich4321, have you executed that `brew…` command?