千家信息网

centos6如何安装php模块

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,这篇文章主要介绍"centos6如何安装php模块",在日常操作中,相信很多人在centos6如何安装php模块问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"cento
千家信息网最后更新 2026年11月01日centos6如何安装php模块

这篇文章主要介绍"centos6如何安装php模块",在日常操作中,相信很多人在centos6如何安装php模块问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"centos6如何安装php模块"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!


本文操作环境:centos 6系统、php 5.6、thinkpad t480电脑。

下面是centos6.5编译安装php 5.6(apache模块)的方法步骤:

一、环境准备

1、下载php源码包

# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz# tar -xf php-5.6.30.tar.gz -C /usr/local/src/

2、创建www用户

# groupadd www# useradd -g www -s /sbin/nologin -M www

3、安装epel源

# yum install epel-release -y

4、安装依赖包

# yum install gcc gcc-c++ make zlib zlib-devel libxml2 libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv libiconv-devel freetype-devel libpng-devel gd bison bison-devel readline-devel gd-devel libicu-devel libedit-devel libcurl-devel sqlite-devel jemalloc jemalloc-devel libxslt-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt pcre pcre-devel bzip2 bzip2-devel curl curl-devel openssl-devel openldap openldap-devel -y

二、编译安装

./configure --prefix=/usr/local/php \--with-config-file-path=/etc/php/ \--with-apxs2=/usr/local/httpd24/bin/apxs \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-iconv \--with-mcrypt \--with-mhash \--with-openssl \--with-curl \--with-zlib \--with-bz2 \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-xsl \--with-pcre-dir \--with-readline \--with-gettext \--with-xmlrpc \--with-libxml-dir \--enable-shared \--enable-bcmath \--enable-soap \--enable-mbregex \--enable-pcntl \--enable-opcache \--enable-calendar \--enable-shmop \--enable-xml \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-sockets \--enable-ftp \--enable-zip \--enable-gd-jis-conv \--enable-exif \--enable-mbstring \--enable-inline-optimization \--disable-debug \--disable-rpath
# make && make install

三、配置服务

# mkdir /etc/php# cp php.ini-development /etc/php/php.ini

添加环境变量PATH

# vim /etc/profilePATH=$PATH:/usr/local/php/bin    export PATH  # source /etc/profile

查看php配置文件路径

# /usr/local/php/bin/php --ini

查看php编译参数

# /usr/local/php/bin/php-config

四、配置apache支持php

修改Apache的配置文件httpd.conf
DirectoryIndex index.html index.php #添加index.php
找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
添加如下内容
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php
检查LoadModule php5_module modules/libphp5.so 是否已经添加 libphp5.so文件是否存在
编写测试文件index.php内容如下,放到Apache的默认的Web站点目录DocumentRoot #默认路径/var/www/html

启动Apache服务,若启动失败,查看配置文件httpd.conf,找到错误日志error.log,针对问题修改。

service httpd restart

用浏览器访问http://IP/,可以查看到PHP配置就表示你成功了

到此,关于"centos6如何安装php模块"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!

配置 模块 文件 学习 环境 编译 内容 方法 更多 路径 问题 帮助 服务 实用 成功 接下来 参数 变量 文章 日志 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网科技工作委员会毛军 广州互联网科技公司 上游互联网科技 互联网 科技服务平台 新华互联网科技2019 昭通云南众福互联网科技有限公司 互联网校园科技培训 互联网科技革命什么开始 佛山市拉法互联网科技有限公司 浙南科技城互联网大厦招聘 互联网科技股为什么大涨 互联网科技年终奖 风投北京互联网科技 易企秀互联网科技是做什么的 普陀区互联网教育科技管理办法 陕西九四连强互联网科技有限公司 互联网科技和医药行业 北京品多多互联网科技有限公司 10位科技互联网大佬 伍佰万互联网科技是干嘛的 互联网科技公司官网 狮子座互联网科技培训 互联网科技论坛 互联网之后的科技是什么 西安小鹰速贷互联网科技有限公司 徐州市互联网科技有限公司 山东有哪些互联网科技公司 互联网科技资金流入 互联网科技创业有什么好项目 六子台科技互联网展会
0