编译安装php5 解决编译安装的php加载不了gd
1、 编译安装php需要的模块:
yum install libxml2-devel libxml2 curl curl-devel libpng-devel libpng openssl openssl-devel -y
yum install php-mcrypt libmcrypt libmcrypt-devel freetype* libjpeg-devel
2、编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring=all --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-shared --with-gd --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/include/freetype2/freety --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mcrypt
3、安装make && make install
4、配置文件cp php.ini-production /usr/local/php/etc/php.ini
cd /usr/local/php/etc && cp php-fpm.conf.default php-fpm.conf
5、配置php-fpm启动脚本
[root@iZbp1f922lx535jt6fpxm5Z sbin]# vim /lib/systemd/system/php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/run/php-fpm/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config=/usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -SIGINT $PIDFILE
[Install]
WantedBy=multi-user.target

配置环境变量 /etc/profile最后加上如下这句
export PATH=$PATH:/usr/local/php/bin
至此已编译ok
下面是利用phpize安装php扩展gd模块
1、进入gd目录执行phpize命令后,当前目录会生成一个新的configure文件,如果没有可能是没有autoconf,yum -y install autoconf安装一下

然后执行./configure --with-php-config=/usr/local/php/bin/php-config
然后make && make install
执行结束后,会出现下面画面,表示安装成功

2、配置php.ini
去掉extension=php_gd2.dll 前面的分号取消注释
修改php.ini中 extension_dir = “ext” 为绝对路径 extension_dir = “”/usr/local/src/php-5.5.38/ext/“”
在php.ini最后加上下面这句
extension = /usr/local/php/lib/php/extensions/no-debug-zts-20121212/gd.so
3、重启nginx php-fpm
systemctl restart php-fpm
systemctl restart nginx
4、验证安装是否成功

其他gd库
JPEG https://blog.csdn.net/zzzxxbird/article/details/53609783
freetype
先yum install freetype*
再找到freetype位置,find / -name freetype
最后重新编译php
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring=all --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-shared --with-gd --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/include/freetype2/freety --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mcrypt
zlib https://blog.csdn.net/azh89125/article/details/78464784
redis https://www.cnblogs.com/doseoer/p/6161110.html
解决yum 安装没有libphp5.so
1、安装
yum install httpd
yum install httpd-devel
2、找到apsx 所在路径

3、加上apsx后重新编译php
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring=all --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-shared --with-gd --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/include/freetype2/freety --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mcrypt --with-apxs2=/usr/bin/apxs
make && make install
4. 修改apache配置文件,Centos7.4 下的apache2.4的配置文件路径为
vim /etc/httpd/conf/httpd.conf
//在LoadModule后面添加:LoadModule php5_module modules/libphp5.so //不添加则访问.php文件将会变成下载
//在DirectoryIndex后面添加:index.php
//在AddType application/x-gzip .gz .tgz后面添加:AddType application/x-httpd-php .php //.php前面有一个空格
5、重启httpd
编译安装php5 解决编译安装的php加载不了gd的更多相关文章
- Laravel4快速安装方法,解决Laravel4安装速度慢
Laravel4原始安装方法 Laravel4 是构建在 Composer 之上的, 之前的安装方法是如下: composer create-project laravel/laravel you ...
- 解决win7 下 curl无法加载的问题
最近分别在WIN7和Windows8 上分别安装php 高版本!都遇到了这个问题! 一.win7系统64位, apache2.2, php 5.35 vc6 版本 这个比较容易: 1. phpinfo ...
- 解决MWPhotoBrowser中的SDWebImage加载大图导致的内存警告问题
下面两种现象,用同一种方法解决 1.解决MWPhotoBrowser中的SDWebImage加载大图导致的内存警告问题 2.突然有一天首页访问图片很慢,至少隔20多秒所有图片才会出来.(解析:app使 ...
- 解决hibernate中的懒加载(延迟加载)问题
解决hibernate中的懒加载(延迟加载)问题 我们在开发的时候经常会遇到延迟加载问题,在实体映射时,多对一和多对多中,多的一样的属性默认是lazy="true"(即,默认是 ...
- 解决ArcGIS API for Silverlight 加载地图的内外网访问问题
原文:解决ArcGIS API for Silverlight 加载地图的内外网访问问题 先上一个类,如下: public class BaseClass { public static string ...
- 解决tableView中cell动态加载控件的重用问题
解决tableView中cell动态加载控件的重用问题 tableView的cell,有时候需要在运行时取得对应的数据后才能够动态的创建该cell中的控件并加载到该cell中,此时,你一定会遇到重用问 ...
- Kali之——解决物理机U盘安装Kali Linux2018.1,光驱无法加载问题
Kali系统和烧录软件 链接:https://pan.baidu.com/s/1v78d62hdF95NM2minct9sw 提取码:b08k 1.无效的方法: (1)执行 df -m,然后查看U盘设 ...
- homebrew安装和解决brew安装速度慢的问题
homebrew安装 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/inst ...
- 解决物理机U盘安装Kali Linux2018.1,光驱无法加载问题
1.无效的方法: (1)执行 df -m,然后查看U盘设备是否挂载到了/media,导致cd-rom不能被挂载,执行 umount /media. (2)在光驱加载安装界面,把U盘拔下换到电脑的另外 ...
随机推荐
- APP中https证书有效性验证引发安全问题(例Fiddler可抓https包)
原文: https://blog.csdn.net/woddle/article/details/71175140 在实际项目代码审计中发现,目前很多手机银行虽然使用了https通信方式,但是只是简单 ...
- Socket的长连接和短连接
讨论Socket必讨论长连接和短连接 一.长连接和短连接的概念 1.长连接与短连接的概念:前者是整个通讯过程,客户端和服务端只用一个Socket对象,长期保持Socket的连接:后者是每次请求,都新建 ...
- https证书的验证过程与生成方法
1.简洁的解释: 1.服务器 用RSA生成公钥和私钥2.把公钥放在证书里发送给客户端,私钥自己保存3.客户端首先向一个权威的服务器检查证书的合法性,如果证书合法,客户端产生一段随机数,这个随机数就作为 ...
- Linux下rz,sz与ssh的配合使用
Linux下rz,sz与ssh的配合使用 一般来说,linux服务器大多是通过ssh客户端来进行远程的登陆和管理的,使用ssh登陆linux主机以后,如何能够快速的和本地机器进行文件的交互呢,也就是上 ...
- 高通平台读写nv总结
一,引言 1. 什么是NV 高通平台的NV,保存了系统运行过程中各个模块可能用到的一些参数值,它是以单个文件的形式保存在EFS中,但用户是不能随意访问的,只能通过QXDM来进行读 ...
- C#存储过程中传入传出参数
作者:卞功鑫 ,转载请保留http://www.cnblogs.com/BinBinGo/p/6399847.html //1 连接字符串 string connectionString = &qu ...
- lesson
需要深入研究:1.pinctrl子系统2.gpio子系统3.dtsi的处理架构4.printk的log级别和log机制5.中断子系统6.console是什么?log来自哪里?7.kernel命令行参数 ...
- c#数组用法
随机数: string[] str = new string[4]{"a","b","c","d"} Readom r ...
- string类和stringBuilder类
字符串是C#中的一种重要数据类型,在项目开发中,离不开字符串操作.C#提供了string类实现字符串操作.于Convert类相似,string类中方法有静态方法和非静态方法.注意,在C#中String ...
- centos7安装mysql 8
1.查看已有mysql(包括mariadb) rpm -pa | grep mariadb yum list installed | grep mariadb rpm -pa | grep mysql ...