PHP .ini configuration file

Hello.

Do Whisk uses a php.ini configuration file reference for PHP, or something similar?
If it does, where is it?
How about wrappers?

I'm trying to do file_get_contents(), but it seems I need a https wrapper enabled. Can Whisk do that?

file_get_contents() should generally work, what error is it giving you and what is your php path to binary?

Perhaps you're hitting a sandboxing/mac security restriction trying to read a file, especially if you're using the Mac App Store version? Please see:

Likewise you may need to add Whisk to Full Disk Access or check parts of Files and Folders in the macOS Security->Privacy Preference Pane since that can also deny access to files you are trying to read.


To more generically answer about a php.ini file though:

Whisk executes PHP by calling into the command line php binary at the path specified in Whisk's General Preferences.

Whisk doesn't use its own php.ini file, so is using whatever the default may be. You could probably set it up by writing a little trampoline shell script that calls this php binary using the --php-ini (or -c) argument. Whisk doesn't use any other arguments and just sends your document via stdout and reads the rendered page via stdin, so this should be pretty straight forward. Probably looking something like:

#!/bin/sh
/path/to/php --php-ini /path/to/php.ini

Then chmod 755 this file and set its path to the PHP "Path to binary" in Whisk's preferences instead.

However do note that as Whisk executes PHP via command line, it isn't in a server environment, so I'd guess a decent amount of php.ini stuff may not apply. This likely includes anything related to https. Also if the PHP you're using is "Built into Whisk" then you may just want to try a different version (like a homebrew install or mamp) since there may be module differences.

Thanks for the quick response.

I'm trying to use file_get_contents() with an external URL, starting with "https". Local files work fine. The PHP warning I get directly in the render pane is:

Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

That error happens when I use the included php executable in Whisk (set in the prefs). The "local installation" option in the prefs leads to a symbolic link to my PHP 8 install. If I try anything other than the option integrated to Whisk, like my install of PHP 8 (using Brew), the app renders nothing. I get an error in the console that says:

Whisk ERROR rendering PHP: launch path not accessible

It looks like a sandbox restriction. My PHP install executable has permissions 555. I set Whisk to have full access to the disk in System Prefs. My best guess is that MacOS doesn't want Whisk to execute something outside of Whisk.app. If it's the case, then this would make the pref options essentially useless.

My other guess is that the PHP executable inside Whisk.app may not have OpenSSL "baked in", and can't access anything else outside the app bundle.

Any other insight would be appreciated. Thank you.

Ah, gotchya. It is correct that the built-in one does not come with OpenSSL. (This is on the list to add now).

Theoretically you should still be able to execute binaries if Whisk's File Access settings are configured to give access to the / directory, but I can reproduce the problem of not being able to use other PHP installs on the macOS 12.5 beta no matter what I do.

This is with the Mac App Store version only, I assume that is what you are using? I won't be able to investigate this much more until I'm home from 4th of July travels later next week. Can you let me know what version of macOS you are running and if your machine is Apple Silicon or Intel?

In my testing you should be able to run custom/homebrew installations with the direct download version of Whisk here:

If that works for you let me know and I can DM you a serial number for that version.

Thanks!

Yes, I was using the App Store version. I tried the version you provided and it does work with the PHP install I have. It doesn't work with Whisk's included version, though. I didn't know there was an alternate, non-App Store version. So, it's working now for what I wanted to do. Thank you.

I'm using Mac OS Monterey 12.4, on a Mac Studio M1 Max (2022).

Also, I'm still into the trial period, I was trying the app out. As long as I can buy this version later, I'll be fine.

Yeah - Whisk's version is missing the OpenSSL library, but as long as the other versions run they should work correctly.

Thanks for the additional configuration information.

Yes, you're welcome to purchase it later through the Tumult Store instead of the Mac App Store.

Thank you!