下载软件包
四、下载php
us.php.net/get/php-5.3.10.tar.gz/from/cn2.php.net/mirror php
http://cn2.php.net/distributions/php-5.6.19.tar.gz html
五、下载cmake(MySQL编译工具)
http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz java
https://cmake.org/files/v3.5/cmake-3.5.0.tar.gz mysql
六、下载libmcrypt(PHPlibmcrypt模块)
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
七、下载Zend Guard (须要注册)
http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz linux
http://downloads.zend.com/guard/7.0.0/zend-loader-php5.6-linux-x86_64.tar.gz nginx
安装篇
如下是用putty工具远程登陆到服务器,在命令行下面操做的
1、安装libmcrypt
sql
cd /usr/local/src tar zxvf libmcrypt-2.5.7.tar.gz #解压 cd libmcrypt-2.5.7 #进入目录 ./configure #配置 make #编译 make install #安装
2、安装cmake
shell
cd /usr/local/src tar zxvf cmake-2.8.7.tar.gz cd cmake-2.8.7 ./configure make #编译 make install #安装
3、安装pcre
数据库
cd /usr/local/src mkdir /usr/local/pcre #建立安装目录 tar zxvf pcre-8.30.tar.gz cd pcre-8.30 ./configure --prefix=/usr/local/pcre #配置 make make install
6、安装php api
cd /usr/local/src tar -zvxf php-5.3.10.tar.gz cd php-5.3.10 mkdir -p /usr/local/php5 #创建php安装目录 ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl #配置 make #编译 make install #安装 cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录 rm -rf /etc/php.ini #删除系统自带配置文件 ln -s /usr/local/php5/etc/php.ini /etc/php.ini #添加软连接 cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件 vi /usr/local/php5/etc/php-fpm.conf #编辑 user = www #设置php-fpm运行帐号为www group = www #设置php-fpm运行组为www pid = run/php-fpm.pid #取消前面的分号 设置 php-fpm开机启动 cp /usr/local/src/php-5.3.10/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 #设置开机启动 vi /usr/local/php5/etc/php.ini #编辑配置文件 找到:;open_basedir = 修改成:open_basedir = .:/tmp/ #防止php木马跨站,重要!! 找到:disable_functions = 修改成: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版本的信息 找到:display_errors = On 修改成:display_errors = OFF #关闭错误提示
7、配置nginx支持php
vi /usr/local/nginx/conf/nginx.conf 修改/usr/local/nginx/conf/nginx.conf 配置文件,需作以下修改 user www www; #首行user去掉注释,修改Nginx运行组为www www;必须与/usr/local/php5/etc/php-fpm.conf中的user,group配置相同,不然php运行出错 index index.php index.html index.htm; #添加index.php # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } #取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改成$document_root$fastcgi_script_name,或者使用绝对路径 /etc/init.d/nginx restart #重启nginx
8、配置php支持Zend Guard
安装Zend Guard cd /usr/local/src mkdir /usr/local/zend #创建Zend安装目录 tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz #解压安装文件 cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/ #拷贝文件到安装目录 vi /usr/local/php5/etc/php.ini #编辑文件 在最后位置添加如下内容 [Zend Guard] zend_extension=/usr/local/zend/ZendGuardLoader.so zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 zend_loader.license_path= 测试篇 cd /usr/local/nginx/html/ #进入nginx默认网站根目录 rm -rf /usr/local/nginx/html/* #删除默认测试页 vi index.php #新建index.php文件 <?php phpinfo(); ?> :wq! #保存 chown www.www /usr/local/nginx/html/ -R #设置目录全部者 chmod 700 /usr/local/nginx/html/ -R #设置目录权限 shutdown -r now #重启 在客户端浏览器输入服务器IP地址,能够看到相关的配置信息! service nginx restart #重启nginx service mysqld restart #重启mysql /usr/local/php5/sbin/php-fpm #启动php-fpm /etc/rc.d/init.d/php-fpm restart #重启php-fpm /etc/rc.d/init.d/php-fpm stop #中止php-fpm /etc/rc.d/init.d/php-fpm start #启动php-fpm ############################################################################# 备注: nginx默认站点目录是:/usr/local/nginx/html/ 权限设置:chown www.www /usr/local/nginx/html/ -R MySQL数据库目录是:/data/mysql 权限设置:chown mysql.mysql -R /data/mysql
分类: Linux |
今天配置一台server的php支持curl的时候, 出现以下报错
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
其实就是curl的dev包没有安装, 解决方案:
终端下
# yum -y install curl-devel
而后就能够继续了
yum install openssl openssl-devel
ln -s /usr/lib64/libssl.so /usr/lib/
安装PHP的时候提示这个错误 configure: error: png.h not found.,这个是选择安装GD模块才会出现的错误,详细错误信息以下
If configure fails try --with-vpx-dir=<DIR>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: png.h not found.
我找了下资料说是libpng没有安装,因而我执行命令 $>yum install libpng 可是并无解决,想了下是否是还有什么devel包没安装吧,试了下面这个命令 $> yum install libpng-devel 终于解决了,呵呵。记录下来,方便你们和本身下次查看。