PHP中高级工程师面试重点讲解视频课程
Go快速入门浅显易懂视频教程-基础篇
Go快速入门浅显易懂视频教程-中级篇
php环境搭建
阅读:2022 分享次数:0

<?php


/**

 * 1 php的windows环境安装 wamp

 * 2.php的linux环境安装 lnmp

 *

 * windows下的php环境安装建议大家下载:phpStudy

 * 我推荐大家安装的教程是:https://jingyan.baidu.com/article/e52e36154227ef40c70c5147.html

 *

 * linux下安装lnmp环境

 * 系统环境:centos5.5的webserver版的系统,相关软件:nginx-1.5.10.tar.gz, mysql-5.5.38,php-5.4.29,libmcrypt-2.5.7 所有的源文件放在/root/zengzhihai/下面

 *

 * 准备:yum -y install libmcrypt,yum -y install libmcrypt-devel,yum -y groupinstall "Development Tools",yum -y groupinstall "Development Libraries",yum -y install wget autoconf automake bison bzip2 bzip2-devel curl curl-devel cmake cpp crontabs diffutils elinks e2fsprogs-devel expat-devel file flex freetype-devel gcc gcc-c++ gd glibc-devel glib2-devel gettext-devel gmp-devel icu kernel-devel libaio libtool-libs libjpeg-devel libpng-devel libxslt libxslt-devel libxml2 libxml2-devel libidn-devel libcap-devel libtool-ltdl-devel libc-client-devel libicu libicu-devel lynx zip zlib-devel unzip patch mlocate make ncurses-devel readline readline-devel vim-minimal sendmail pam-devel pcre pcre-devel openldap openldap-devel openssl openssl-devel

 *

 * 1:yum remove httpd* -y 删除webserver版上面默认安装的http的服务

 * 2:安装需要准备的一些软件

 * 3:

 * 首先添加用户nginx,实现以之运行nginx服务进程:

 * # groupadd -r nginx

 * # useradd -r -g nginx nginx

 * 4.接着开始编译和安装:

 * # ./configure \

 * --prefix=/usr/local/nginx \

 * --sbin-path=/usr/sbin/nginx \

 * --conf-path=/usr/local/nginx/conf/nginx.conf \

 * --error-log-path=/data/nginx/log/nginx/error.log \

 * --http-log-path=/data/nginx/log/nginx/access.log \

 * --pid-path=/usr/local/nginx/run/nginx/nginx.pid  \

 * --lock-path=/usr/local/nginx/lock/nginx.lock \

 * --user=nginx \

 * --group=nginx \

 * --with-http_ssl_module \

 * --with-http_flv_module \

 * --with-http_stub_status_module \

 * --with-http_gzip_static_module \

 * --http-client-body-temp-path=/usr/local/nginx/tmp/nginx/client/ \

 * --http-proxy-temp-path=/usr/local/nginx/tmp/nginx/proxy/ \

 * --http-fastcgi-temp-path=/usr/local/nginx/tmp/nginx/fcgi/ \

 * --http-uwsgi-temp-path=/usr/local/nginx/tmp/nginx/uwsgi \

 * --http-scgi-temp-path=/usr/local/nginx/tmp/nginx/scgi \

 * --with-pcre

 *

 * # make && make install

 * 而后就可以启动服务并测试了:

 * # /etc/init.d/nginx start

 *

 * 5:安装mysql

 * # mkdir /usr/local/mysql

 * # mkdir -pv /data0/mysql/data

 * # groupadd mysql

 * # useradd -r -g mysql mysql

 * # cd mysql-5.5.38

 * # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

 * -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \

 * -DDEFAULT_CHARSET=utf8 \

 * -DDEFAULT_COLLATION=utf8_general_ci \

 * -DWITH_MYISAM_STORAGE_ENGINE=1 \

 * -DWITH_INNOBASE_STORAGE_ENGINE=1 \

 * -DWITH_MEMORY_STORAGE_ENGINE=1 \

 * -DWITH_READLINE=1 \

 * -DENABLED_LOCAL_INFILE=1 \

 * -DMYSQL_DATADIR=/data0/mysql/data \

 * -DMYSQL_USER=mysql \

 * -DMYSQL_TCP_PORT=3306

 * # make && make install

 * # chown -R mysql:mysql /usr/local/mysql

 * # chown -R mysql:mysql /data0/mysql

 * # cd /usr/local/mysql/

 * # cp support-files/my-medium.cnf /etc/my.cnf

 * # 创建系统库

 * # /usr/local/mysql/scripts/mysql_install_db \

 * --basedir=/usr/local/mysql \

 * --datadir=/data0/mysql/data \

 * --user=mysql

 * # vi /etc/profile

 * 在修改PATH=$PATH:$HOME/bin为:

 * PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

 * # source /etc/profile

 * # ./bin/mysqld_safe --user=mysql &

 * # 将mysql的启动服务添加到系统服务中

 * # cp support-files/mysql.server /etc/init.d/mysql

 * # vi /etc/init.d/mysql

 * basedir=/usr/local/mysql

 * datadir=/data0/mysql/data

 * # /etc/init.d/mysql start

 * # chkconfig mysql --level 235 on

 * 6: 安装php

 * # cd php-5.4.4

 * #  ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --enable-sockets --enable-sysvshm  --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr/include/freetype2/freetype --with-libxml-dir=/usr --with-vpx-dir=/usr --enable-xml  --with-mhash --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl=/usr

 * # make && make install

 * 为php提供配置文件:

 * # cp php.ini-production /etc/php.ini

 * 为php-fpm提供Sysv init脚本,并将其添加至服务列表:

 * # cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm

 * # chmod +x /etc/rc.d/init.d/php-fpm

 * # chkconfig --add php-fpm

 * # chkconfig php-fpm on

 *

 * 为php-fpm提供配置文件:

 * # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf 

 *

 * 编辑php-fpm的配置文件:

 * # vim /usr/local/php/etc/php-fpm.conf

 * 配置fpm的相关选项为你所需要的值,并启用pid文件(如下最后一行):

 * pm.max_children = 150

 * pm.start_servers = 8

 * pm.min_spare_servers = 5

 * pm.max_spare_servers = 10

 * pid = /usr/local/php/var/run/php-fpm.pid 

 *

 * 接下来就可以启动php-fpm了:

 * # service php-fpm start

 * 7: 整合nginx和php5

 * 编辑/etc/nginx/nginx.conf,启用如下选项:

 * location ~ \.php$ {

 *      root           html;

 *      fastcgi_pass   127.0.0.1:9000;

 *      fastcgi_index  index.php;

 *      fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

 *      include        fastcgi_params;

 * }

 * lnmp可以参考:lnmp环境搭建

 *

 *

 */


感觉本站内容不错,读后有收获?