网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > 服务器环境搭建
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

服务器环境搭建 Windows,Linux,IIS,Apache等服务器配置、安全维护以及PHP和MYSQL运行环境讨论。

Reply
 
Thread Tools Display Modes
  #1   IP: 180.125.123.149
Old 2016-05-23, 09:01 AM
Interlachen Interlachen is offline
初级会员
 
Join Date: 2006-12-17
Posts: 1
Interlachen 现在声名狼藉
Default CentOS6.5 下编译安装php-5.6.3.tar.gz

一、安装相关依赖库
Code:
     yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel
二、解压php包

tar -zxvf php-5.6.3.tar.gz

cd php-5.6.3

export LD_LIBRARY_PATH=/usr/local/libgd/lib

三、编译安装
Code:
 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/usr/local/mysql/mysql.sock  --with-apxs2=/usr/local/apache/bin/apxs --with-gd --with-jpeg-dir --with-png-dir --enable-mbstring --enable-xml --enable-fpm --with-freetype-dir --with-mcrypt --with-mhash --with-libxml-dir --with-zlib-dir

 make

 make install
四、配置php

cp php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录

ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接到 /etc目录
rm -rf /etc/php.ini #删除系统自带配置文件

vi /etc/php.ini

找到:disable_functions =

修改为:
Code:
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。

找到:;date.timezone =

修改为:date.timezone = PRC #设置时区

找到:expose_php = On

修改为:expose_php = Off #禁止显示php版本的信息

找到:short_open_tag = Off

修改为:short_open_tag = ON #支持php短标签

:wq! 保存





cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件

ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #添加软连接到 /etc目录

vi /usr/local/php/etc/php-fpm.conf #编辑

user = www #设置php-fpm运行账号为www

group = www #设置php-fpm运行组为www

pid = run/php-fpm.pid #取消前面的分号

:wq! #保存退出



cp /home/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动

编辑apache配置文件httpd.conf,以apache支持php
# vim /etc/httpd/httpd.conf
添加如下



AddType application/x-httpd-php .php .phtml
定位至DirectoryIndex index.html

修改为:
DirectoryIndex index.php index.html
添加index.php为默认主页

重新启动apache

五、测试

在/usr/local/apache/htdocs目录下建一个test.php或test.phtml的文件,内容如下示:

<</FONT>

?

php

phpinfo();

?

>

:wq! #保存退出
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 02:54 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.