Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abkrim's avatar
Level 13

Laravel Herd, macos y Ioncube

Out of necessity, I have to install software that is protected with ioncube, to be able to develop some modules locally.

I have recently been using Laravel Herd

  • When I consult a phpinfo() for the location of the modules, it gives me a path that does not exist. /lib/php/extensions/no-debug-non-zts-20210902

  • On top of that I am forced to use php 8.1 (wonderful world of proprietary software that the development version can still only use php 8.1)

  • If I download the Ioncube autoinstaller I get nothing.

  • Not manually either because I don't know where the path of the modules is.

  • Brew doesn't take me either... but I'm surprised to see that if I do a php -m in the shell with the php8.1 bversion active, all the modules are there...

This is a bit confusing.

0 likes
3 replies
LaryAI's avatar
Level 58

It sounds like you're having trouble locating the correct extension directory for your PHP installation and installing the IonCube loader for PHP 8.1 on macOS while using Laravel Herd. Here's a step-by-step guide to help you resolve this issue:

  1. Locate the Correct PHP Extension Directory: First, you need to find the correct extension directory for your PHP installation. You can do this by running the following command in your terminal:

    php -i | grep extension_dir
    

    This command will output the path to the extension directory used by your PHP CLI. It's important to note that the extension directory for PHP CLI can be different from the one used by your web server.

  2. Download the Correct IonCube Loader: Go to the IonCube download page and download the loaders for macOS. Make sure to select the version that matches your PHP version (in this case, PHP 8.1).

    IonCube download page: https://www.ioncube.com/loaders.php

  3. Install the IonCube Loader: Once you have downloaded the correct IonCube loader, you need to install it in the extension directory you found in step 1. If the directory does not exist, you may need to create it.

    Unzip the downloaded file and copy the ioncube_loader_dar_8.1.so file to the extension directory.

    sudo cp ioncube_loader_dar_8.1.so /path/to/your/extension_dir
    

    Replace /path/to/your/extension_dir with the actual path to your PHP extension directory.

  4. Configure PHP to Use the IonCube Loader: You need to tell PHP to load the IonCube extension. This is done by editing the php.ini file. You can find the location of your php.ini file by running:

    php --ini
    

    Open the php.ini file with a text editor and add the following line at the end of the file:

    zend_extension = /path/to/your/extension_dir/ioncube_loader_dar_8.1.so
    

    Again, replace /path/to/your/extension_dir with the actual path to your PHP extension directory.

  5. Restart Your Web Server: If you're using Laravel Herd, it might be using Laravel Valet under the hood. You can restart Valet using the following command:

    valet restart
    

    If you're using a different server, make sure to restart it so that the changes take effect.

  6. Verify the Installation: To verify that the IonCube loader has been installed correctly, you can create a PHP file with the following content and navigate to it in your web browser, or run it from the command line:

    <?php
    phpinfo();
    

    Look for the IonCube section in the phpinfo() output to confirm that it's installed and configured correctly.

Remember that Laravel Herd might be using Docker containers or another isolated environment, so you may need to apply these changes within the specific environment that Herd is using. If Herd is using Docker, you would need to enter the Docker container and perform these steps inside the container, or adjust the Dockerfile to include the IonCube loader installation.

abkrim's avatar
Level 13

@LaryAI

❯ php -i | grep extension_dir
extension_dir => /lib/php/extensions/no-debug-non-zts-20210902 => /lib/php/extensions/no-debug-non-zts-20210902
sqlite3.extension_dir => no value => no value
❯ la /lib/php/extensions/no-debug-non-zts-20210902
ls: /lib/php/extensions/no-debug-non-zts-20210902: No such file or directory

Also, I speak about Larvel Herd

Bye, bye.

fahadyousaf's avatar

I hope you already found it. Click "Open Configuration Files" in the popup menu by clicking the HERD icon in the top bar. It'll take you to a path like this

/Users/{username}/Library/Application Support/Herd/config/php

Open the directory related to the PHP version and you'll find the php.ini in it Add your configuration at the top.

zend_extension=/path/to/ioncube_loader_dar.so

Stop all HERD services nad restart the HERD.

Please or to participate in this conversation.