部署php

安装依赖

#解压PHP软件,进行编译安装,将程序安装到/application目录中,并且创建软链接
#安装其它相关依赖程序---libmcrypt  
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum -y install libmcrypt-devel mhash mcrypt rpm -qa libmcrypt-devel mhash mcrypt http://php.net/releases/ yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel -y yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel

安装PHP软件程序

tar xf php-5.5.32.tar.gz
    cd php-5.5.32           #----正式编译前也可以把这个软件安装上(libxslt*
.
/configure --prefix=/application/php-5.5.32 \ --with-mysql=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-mcrypt \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=www \ --with-fpm-group=www \ --enable-ftp \ --enable-opcache=no ##提示 如下内容 即成功 Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+
[root@web01 php-5.5.32]# make install
[root@web01 php-5.5.32]# echo $?
0
 
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ #可以不创建 touch ext/phar/phar.phar make && make install
ln -s /application/php-5.5.32/ /application/php #复制php.ini配置文件 [root@web01 php-5.5.32]# cp /home/lewen/tools/php-5.5.32/php.ini-production /application/php-5.5.32/lib/php.ini #复制php-fpm配置文件 [root@web01 php-5.5.32]# cd /application/php-5.5.32/etc/ [root@web01 etc]# ls pear.conf php-fpm.conf.default [root@web01 etc]# cp php-fpm.conf.default php-fpm.conf [root@web01 etc]# ll total 52 -rw-r--r-- 1 root root 1332 Feb 27 22:53 pear.conf -rw-r--r-- 1 root root 22609 Feb 27 22:56 php-fpm.conf -rw-r--r-- 1 root root 22609 Feb 27 22:53 php-fpm.conf.default [root@web01 etc]# /application/php-5.5.32/sbin/php-fpm -t [27-Feb-2018 22:56:53] NOTICE: configuration file /application/php-5.5.32/etc/php-fpm.conf test is successful [root@web01 etc]# /application/php-5.5.32/sbin/php-fpm [root@web01 etc]# ss -lntup |grep 9000 tcp LISTEN 0 16384 127.0.0.1:9000 *:* users:(("php-fpm",129733,7),("php-fpm",129734,0),("php-fpm",129735,0))

 

LNMP搭建网站前的测试


测试nginx与php配合是否成功
php与MySQL配合是否成功


测试nginx与php配合是否成功
server {
        listen       80;
        server_name  blog.etiantian.org;
        root   html/blog;
        index  index.php index.html index.htm;
        location ~ .*\.(php|php5)?$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include       fastcgi.conf;
        }
}
echo '<?php phpinfo();?>' >/application/nginx/html/blog/test_info.php


php与MySQL配合是否成功
test_mysql.php
<?php
     //$link_id=mysql_connect('主机名','用户','密码');
    $link_id=mysql_connect('172.16.1.51','wordpress','123456') or mysql_error();
    if($link_id){
         echo "mysql successful by oldboy ! \n";
    }else{
         echo mysql_error();
    }
?>



#部署博客 
https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
chown -R www.www  *

 

posted @ 2018-03-08 10:44  元贞  阅读(122)  评论(0编辑  收藏  举报