首页 > 技术分享 > LNMP|WAMP
收藏

debian使用apt一键安装PHP所有版本与扩展

09/27 17:19
大潇博客 原创文章,转载请标明出处

每次安装PHP都要逐个安装扩展,略显繁琐,为了省时省力,写了这篇文章。

首先添加PHP源,推荐使用sury源,下面有相关文章。


首先安装一个PHP,将成为cli模式的默认版本,不过想一键安装所有的,以后还可以单独设置。


安装PHP:

apt -y php8.3

apt -y install php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 php8.0 php8.1 php8.2 php8.4


安装PHP扩展:

apt install -y php5.6-fpm php5.6-gd php5.6-curl php5.6-mysql php5.6-redis php5.6-memcache php5.6-memcached php5.6-xml php5.6-mbstring php5.6-mcrypt php5.6-zip php5.6-imagick php7.0-fpm php7.0-gd php7.0-curl php7.0-mysql php7.0-redis php7.0-memcache php7.0-memcached php7.0-xml php7.0-mbstring php7.0-mcrypt php7.0-zip php7.0-imagick php7.1-fpm php7.1-gd php7.1-curl php7.1-mysql php7.1-redis php7.1-memcache php7.1-memcached php7.1-xml php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-imagick php7.2-fpm php7.2-gd php7.2-curl php7.2-mysql php7.2-redis php7.2-memcache php7.2-memcached php7.2-xml php7.2-mbstring php7.2-mcrypt php7.2-zip php7.2-imagick php7.3-fpm php7.3-gd php7.3-curl php7.3-mysql php7.3-redis php7.3-memcache php7.3-memcached php7.3-xml php7.3-mbstring php7.3-mcrypt php7.3-zip php7.3-imagick php7.4-fpm php7.4-gd php7.4-curl php7.4-mysql php7.4-redis php7.4-memcache php7.4-memcached php7.4-xml php7.4-mbstring php7.4-mcrypt php7.4-zip php7.4-imagick php8.0-fpm php8.0-gd php8.0-curl php8.0-mysql php8.0-redis php8.0-memcache php8.0-memcached php8.0-xml php8.0-mbstring php8.0-mcrypt php8.0-zip php8.0-imagick php8.1-fpm php8.1-gd php8.1-curl php8.1-mysql php8.1-redis php8.1-memcache php8.1-memcached php8.1-xml php8.1-mbstring php8.1-mcrypt php8.1-zip php8.1-imagick php8.2-fpm php8.2-gd php8.2-curl php8.2-mysql php8.2-redis php8.2-memcache php8.2-memcached php8.2-xml php8.2-mbstring php8.2-mcrypt php8.2-zip php8.2-imagick php8.3-fpm php8.3-gd php8.3-curl php8.3-mysql php8.3-redis php8.3-memcache php8.3-memcached php8.3-xml php8.3-mbstring php8.3-mcrypt php8.3-zip php8.3-imagick php8.0-swoole php8.1-swoole php8.2-swoole php8.3-swoole php8.4-fpm php8.4-gd php8.4-mysql php8.4-xml php8.4-mbstring php8.4-zip


后面如果出了新的版本,可以通过下面PHP代码生成:

$version=array('5.6','7.0','7.1','7.2','7.3','7.4','8.0','8.1','8.2','8.3');

$arr=array('fpm','gd','curl','mysql','redis','memcache','memcached','xml','mbstring','mcrypt','zip','imagick');

$str="";

foreach($version as $val)

foreach($arr as $v)

$str.="php".$val."-".$v." ";

echo $str;


相关文章:
打赏

阅读排行

大家都在搜

博客维护不易,感谢你的肯定
扫码打赏,建议金额1-10元
  • 15601023311