I have this shell script to install ionCube loader:
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
echo "Welcome to this script to install the ionCube loader on CentOS!"
cd /usr/local/src
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gz
cd ioncube
mkdir /usr/local/ioncube
echo "Please specify which PHP version you are using (e.g.: 5.3)."
read version
cp ioncube_loader_lin_"$version".so /usr/local/ioncube
path=$(php -i|grep php.ini | awk 'NR==2{print $5}')
read path
echo "zend_extension = /usr/local/ioncube/ioncube_loader_lin_"$version".so" >> "$path"
When I try to run it on CentOS 6.5 Final with this PHP version (php -v):
PHP 5.3.28 (cli) (built: Jun 23 2014 16:25:09)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
I get the following error:
./ioncube.sh: line 17: : File or folder doesn't exist
Line 17:
echo "zend_extension = /usr/local/ioncube/ioncube_loader_lin_"$version".so" >> "$path"
The error says that $path doesn't exist. When I try to manually run the command of $path (php -i|grep php.ini | awk 'NR==2{print $5}'), the output is:
/usr/local/lib/php.ini
When I try to run line 17 but replace $path with the actual output of the command (of course I'll replace $version too):
echo "zend_extension = /usr/local/ioncube/ioncube_loader_lin_"5.3".so" >> "/usr/local/lib/php.ini"
The command succeeds.
I don't understand what's wrong here.