安装php环境+nginx
下载php
wget http://cn2.php.net/distributions/php-7.2.0.tar.gz
tar xvf php-7.2.0.tar.gz
安装
rpm -qa | grep libjpeg
yum -y install libjpeg-devel
yum list installed | grep libjpeg
rpm -ql libjpeg-turbo
cd /usr/local/php-7.2.0/
./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
如果有错误见下面错误说明
make && make install
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vim /etc/profile
PATH=$PATH:/usr/local/php/bin
export PATH
php-v
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /usr/local/php-7.2.0/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
vim /usr/local/php/etc/php-fpm.d/www.conf
chkconfig --add php-fpm
vi /usr/local/php/etc/php-fpm.d/www.conf
user = nginx
group = nginx
security.limit_extensions = .php .php3 .php4 .php5 .php7 .html .js .css .jpg .jpeg .gif .png .htm
service php-fpm start
Starting php-fpm done
netstat -ano|grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN off (0.00/0/0)
修改nginx
location /{
root /toppgo/www/wordpress-html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
### fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
测试
cd /usr/share/nginx/html
touch index.php;
echo '<?php phpinfo(); ?>' > index.php
访问测试 到此结束
遇到的问题
一、no acceptable C compiler found in $PATH See `config.log' for more details
yum install -y gcc
二、configure: error: xml2-config not found. Please check your libxml2 installation.
yum install libxml2 libxml2-devel -y
三、configure: error: Cannot find OpenSSL's <evp.h>
yum install openssl openssl-devel -y 如果仍然报错:export PHP_OPENSSL_DIR=yes
四、configure: error: Please reinstall the BZip2 distribution
yum install bzip2 bzip2-devel
五、for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
yum -y install curl-devel
六、configure: error: png.h not found.
yum install libpng libpng-devel -y
七、configure: error: freetype-config not found.
yum install freetype-devel -y
八、configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
yum -y install libxslt libxslt-devel
九、当配置PHP时出现 make: *** [ext/fileinfo/libmagic/apprentice.lo] Error
是因为服务器内存不足1G。只需要在配置命令中添加 --disable-fileinfo即可
安装WordPress
https://cn.wordpress.org/download/releases/
https://cn.wordpress.org/wordpress-4.9.4-zh_CN.zip
unzip -d wordpress-html/community/ wordpress-4.9.4-zh_CN.zip
CREATE USER 'word_press'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'toppgo123';
grant all on 4_distri_word_press.* to word_press@127.0.0.1;
flush privileges
评论已关闭。