我正在尝试更新这个 .sh 文件
#!/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
这是我的版本:
#!/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
我做得很好,直到第 18 行
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt>
它向我显示了以下几行:
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>'
因此,这里有任何帮助!!!
答案1
你必须>
从末尾删除第 18 行首先。因此它看起来如下所示:
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php7.4-mcrypt
还应注意,该php7.4-mcrypt
软件包不存在于官方 Ubuntu 存储库中。
因此,Ubuntu 20.04 LTS 的正确(就打包而言)第 18 行应如下所示:
apt-get install libpcre3-dev libcurl3-openssl-dev php7.4-dev php-http php-pear