centos下wordpress的安装

时间秒杀一切 提交于 2020-04-06 06:41:08

 安装php5.6依赖的扩展:

1 yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel

 

 下载解压PHP:

在http://php.net/downloads.php可以下载到最新版本的php,这里下载的是php-5.6.8.tar.gz。

1 wget http://cn2.php.net/distributions/php-5.6.8.tar.gz
2 tar -xzvf php-5.6.8.tar.gz
3 cd php-5.6.8

编译PHP:

 

./configure
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath  \
--enable-shared \
--enable-opcache --enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-readline \
--with-apxs2=/usr/bin/apxs
注意:--with-apxs2=/usr/bin/apxs 需要加上,不然的话apache/modules里面就没有libphp5.so ,httpd.conf也不会加上LoadModule php5_module        modules/libphp5.so这一行。 有了这句,就会自动在apache中增加。

 

configure成功后, 会出现以下内容:

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.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
 

 

 接着执行make,  经过一段时间的等待, 会看到以下内容:

Build complete.
Don't forget to run 'make test'.
    虽然它提示要执行make  test,  不过我本人测试过, 会出现以下类似问题:    

FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #52202 (CURLOPT_PRIVATE gets clobbered) [ext/curl/tests/bug52202.phpt]
Bug #64267 (CURLOPT_INFILE doesn't allow reset) [ext/curl/tests/bug64267.phpt]
Bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes while curl_multi_exec) [ext/curl/tests/bug71523.phpt]
Multicast support: IPv6 receive options [ext/sockets/tests/mcast_ipv6_recv.phpt]
sem_acquire with nowait [ext/sysvsem/tests/nowait.phpt]
FPM: Startup and connect [sapi/fpm/tests/002.phpt]
FPM: Test IPv6 support [sapi/fpm/tests/003.phpt]
FPM: Test IPv4/IPv6 support [sapi/fpm/tests/004.phpt]
FPM: Test IPv4 allowed clients [sapi/fpm/tests/005.phpt]
FPM: Test IPv6 allowed clients (bug #68428) [sapi/fpm/tests/006.phpt]
FPM: Test IPv6 all addresses and access_log (bug #68421) [sapi/fpm/tests/007.phpt]
FPM: Test multi pool (dynamic + ondemand + static) (bug #68423) [sapi/fpm/tests/008.phpt]
FPM: Test Unix Domain Socket [sapi/fpm/tests/009.phpt]
FPM: Test IPv4 all addresses (bug #68420) [sapi/fpm/tests/011.phpt]
FPM: Test reload configuration (bug #68442) [sapi/fpm/tests/012.phpt]
FPM: Test for log_level in fpm_unix_init_main #68381 [sapi/fpm/tests/013.phpt]
FPM: Test for pm.start_servers default calculation message being a notice and not a warning #68458 [sapi/fpm/tests/014.phpt]
FPM: Test splited configuration and load order #68391 [sapi/fpm/tests/016.phpt]
FPM: Test fastcgi_finish_request function [sapi/fpm/tests/017.phpt]
FPM: Test global prefix [sapi/fpm/tests/019.phpt]
FPM: Test pool prefix [sapi/fpm/tests/020.phpt]
FPM: HTTP_PROXY - CVE-2016-5385 [sapi/fpm/tests/022-cve-2016-5385.phpt]
    目前还没解决, 如果有已经解决的高手, 帮忙告知下, 谢谢!

    此问题对使用php影响不大,所以暂时忽略以上问题。

    接着继续执行:

    make  install 

    成功的话可以看到以下结果:    

Installing PHP SAPI module:       apache2handler
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install install libphp5.la /usr/lib64/httpd/modules/
libtool: install: install .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
libtool: install: install .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/hwlxhy/software/php-5.6.36/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM config:        /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:           /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - already installed: 1.4.3
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util       - already installed: 1.4.2
[PEAR] PEAR           - already installed: 1.10.5
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/home/hwlxhy/software/php-5.6.36/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/

 

 

然后php -v, 可以看到:

PHP 5.6.8 (cli) (built: Apr  4 2020 19:00:04) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

 

让Apache支持PHP:

 打开/etc/httpd/conf/httpd.conf文件,在最后面输入以下代码:

1 AddType application/x-httpd-php  .php
2 AddType application/x-httpd-php-source  .phps

定位到DirectoryIndex index.html ,修改为:

1 DirectoryIndex  index.php  index.html

必须要注意的是/etc/httpd/conf/httpd.conf中是否已经开启了php扩展:

1 LoadModule php5_module        modules/libphp5.so

第三部分:安装Wordpress(解压后readme.html有安装步骤)

  1、下载Wordpress:https://wordpress.org/download/   点击Download .tar.gz 下载wordpress 压缩包

  2、解压wordepress 到目录/opt/lampp/htdocs/下:tar -xzvf wordpress-5.4.tar.gz -C /var/www/html/

  3、浏览器中输入http://192.168.1.108/wordpress/index.php   ip 为centos7 的ip,由于是首次打开,自动跳转到安装页面http://192.168.1.108/wordpress/wp-admin/setup-config.php

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