服务器配置PHP环境+Oracle支持

こ雲淡風輕ζ 提交于 2020-02-04 06:58:21

安装Nginx源:

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

安装EPEL源:

(64位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

(32位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

安装REMI源:

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

开启REMI,编辑源设置

vim /etc/yum.repos.d/remi.repo

修改 enable=1

安装基础包:

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libmcrypt libmcrypt-devel pcre-devel

安装PHP+Mysql:

yum -y install nginx mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator

修改/etc/php-fpm.conf 的用户和组为nginx(apache-->nginx)

修改/var/lib/php/session(使php能保存session),web用户组为nginx

chown -R nginx:nginx /var/lib/php/session(不存在则需要创建)
chown -R nginx:nginx /home/htdocs/(web目录)
chmod -R 775 /home/htdocs/ (同组可修改权限,方便配置ftp,ftp应该加入到nginx组,如果需要更高的安全设置,则不应当将只读的目录赋予nginx,php组可写权限)

设置自启动
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysqld on

安装oci8支持

下载oracle-instantclient-basic,oracle-instantclient-devel

安装:

rpm -ivh oracle-instantclient11.2-basic

下载oci8类库:

pear download pecl/oci8

tar xvzf oci8

cd oci8

ln -s /usr/include/oracle/11.2/client /usr/lib/oracle/11.2/client/lib/include

phpize

./configure --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib/

make all install

编译完成后

vim /etc/php.d/oci8.ini

加入extension=oci8.so

php的配置

总配置:/etc/php.ini

启动配置:/etc/php.d/(目录),/etc/php-zts.d/(目录)

nginx的配置

总配置:/etc/nginx/nginx.conf

分配置:/etc/nginx/conf.d/(目录)

php-fpm的配置

总配置:/etc/php-fpm.conf

分配置:/etc/php-fpm.d/(目录)

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!