UpDating .sh file to be compatible with v20.04
I'm trying to update this .sh file
#!/bin/bash
function pecl_install {
pecl install $1
echo "extension=$2.so" | sudo tee /etc/php5/mods-available/$2.ini
echo "; priority=$3" | sudo tee -a /etc/php5/mods-available/$2.ini
php5enmod $2
}
if [ $(/usr/bin/id -u) -ne 0 ]; then
echo "Not running as root"
exit
fi
echo "Installing Apache and PHP"
apt-get install apache2 php5 php5-curl
echo "Installing HTTP extension"
apt-get install libpcre3-dev libcurl3-openssl-dev php5-dev php-http php5-mcrypt php-pear
pecl_install pecl/raphf raphf 20
pecl_install pecl/propro propro 20
pecl_install pecl_http http 30
echo "Enabling Apache modules"
a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
And this is my edtion:
#!/bin/bash
function pecl_install {
pecl install $1
echo "extension=$2.so" | sudo tee /etc/php/7.4/mods-available/$2.ini
echo "; priority=$3" | sudo tee -a /etc/php/7.4/mods-available/$2.ini
php7enmod $2
}
if [ $(/usr/bin/id -u) -ne 0 ]; then
echo "Not running as root"
exit
fi
echo "Installing Apache and PHP"
apt-get install apache2 php7.4 php7.4-curl
echo "Installing HTTP extension"
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt>
pecl_install pecl/raphf raphf 20
pecl_install pecl/propro propro 20
pecl_install pecl_http http 30
echo "Enabling Apache modules"
a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
I do good work unto the line number 18
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt>
It shows me these lines:
Installing HTTP extension
./install.sh: line 18: syntax error near unexpected token `newline'
./install.sh: line 18: `apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt>'
So, Any Help here!!!
Solution 1:
You have to remove >
from end of line 18 first. So it will look like shown below:
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt
Also it should be noted that php7.4-mcrypt
package does not exist in official Ubuntu repositories.
So correct (in packaging terms) line 18 for Ubuntu 20.04 LTS will look like:
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php-pear