Wednesday, March 16, 2022

[SOLVED] How do i save php ext dir in a variable?

Issue

actually i'm creating a bash script for initial setup for servers with some different software. To install ioncube loader into php i need the php extension directory in a variable.

I already tried something like this: php -i | grep extension_dir

but i dont need the output like: extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902

Thats what i need is: /usr/lib/php/20190902

Does anybody know how to get it?


Solution

#!/bin/bash
edvar=$(php -r "echo ini_get('extension_dir');")
echo $edvar


Answered By - Zach
Answer Checked By - Cary Denson (WPSolving Admin)