编程语言
首页 > 编程语言> > ubantu apt-get install安装php及开展

ubantu apt-get install安装php及开展

作者:互联网

12、安装php
apt-get install libapache2-mod-php5 php5

报错
E: Package 'libapache2-mod-php5' has no installation candidate
E: Package 'php5' has no installation candidate

解决方法如下:
add-apt-repository ppa:ondrej/php 
报错:
The program 'add-apt-repository' is currently not installed. You can install it by typing:
apt install software-properties-common

解决:apt install software-properties-common


add-apt-repository ppa:ondrej/php 
apt-get update 


apt-get install libapache2-mod-php5.6 php5.6 php5.6-mcrypt php5.6-gd php5.6-mbstring php-gettext php5.6-mysql

 

 

 

安装curl扩展
sudo apt-cache search curl
php-curl - CURL module for PHP [default]
php5.6-curl - CURL module for PHP
php7.1-curl - CURL module for PHP
php7.2-curl - CURL module for PHP
php7.3-curl - CURL module for PHP
php7.4-curl - CURL module for PHP

apt-get install php5.6-curl
/etc/init.d/apache2 restart

 

 

 

sudo apt-cache search redis

如果没有
则需要源码编译安装

安装redis扩展
wget http://pecl.php.net/get/redis-4.2.0.tgz
tar -zxvf redis-4.2.0.tgz

cd redis-4.2.0

/usr/bin/phpize

./configure --with-php-config=/usr/bin/php-config

make
make test
make install

编辑php.ini 加入扩展
extension = /usr/local/php5.6/lib/php/extensions/debug-non-zts-20131226/redis.so

发现apt-get install安装的php没有php-config和phpize


解决办法:
apt-get install php5.6-cli
apt-get install php5.6-dev



/usr/bin/php-config
/usr/bin/phpize

刘超  12:09:32
/usr/bin/php5.6

刘超  12:09:52
/usr/bin/php 7.3.10版本




cd /etc/php/5.6/mods-available/
rz redis.ini
cd /etc/php/5.6/apache2/conf.d
ln -s /etc/php/5.6/mods-available/redis.ini 10-redis.ini

 

标签:ubantu,get,redis,apt,install,php5.6,php
来源: https://www.cnblogs.com/hnhycnlc888/p/11734488.html