• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

UbuntulampPHP7.2安装mysql和mcrypt扩展

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

PHP 7.2 中安装 mysql 扩展

环境: Ubuntu 18.04 + LAMP(PHP 7.2)

  1. 下载 mysql 仓库到本地 (http://git.php.net/?p=pecl/database/mysql.git;a=summary)
# 下载 php.net mysql仓库到本地
cd /tmp
git clone https://git.php.net/repository/pecl/database/mysql.git
# 进入mysql扩展目录
cd mysql
#使用phpize初始化 
phpize
#查找php-config命令在哪里
vagrant@ubuntu-bionic:/tmp/mysql$ whereis php-config
php-config: /usr/bin/php-config7.2 /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
#编译mysql扩展,使用mysql native driver作为mysql链接库   
./configure --with-php-config=/usr/bin/php-config --with-mysql=mysqlnd 
#编译
vagrant@ubuntu-bionic:/tmp/mysql$ sudo make && sudo make install 
#编译输出
Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/lib/php/20170718/
  1. 接下来,我们直接编辑php.ini文件,把mysql.so拷贝到php.ini的extension_dir中,然后在php.ini 文件末尾添加一行,填入:
extension=mysql.so
  1. 重启 web服务器

sudo apt-get install mcrypt libmcrypt-dev #Ubuntu 安装编译依赖的文件
yum install libmcrypt libmcrypt-devel mcrypt mhash #Centos

在 php 官网下载 mcrypt 包,php 扩展官网

cd /tmp
wget https://pecl.php.net/get/mcrypt-1.0.3.tgz
tar xf mcrypt-1.0.3.tgz
cd mcrypt-1.0.3

编译安装 mcrypt

phpize
./configure --with-php-config=/usr/bin/php-config
sudo make && sudo make install

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/lib/php/20170718/

编辑 php.ini(如: /etc/php/7.2/apache2/php.ini)文件,在文件末尾添加

extension=mcrypt.so

References


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap