CentOS搭建wordpress
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
rm latest.tar.gz
mv wordpress/* .
chown -R apache:apache *
- 查看已经安装的PHP组件
yum list installed| grep php
- 卸载原有PHP组件
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64
- wget安装(安装路径:/usr/src)
wget https://www.php.net/distributions/php-8.2.15.tar.gz
- 解压
tar -zxvf php-8.2.15.tar.gz
- 更名
mv php-8.2.15 php8
- 安装编译所需要的依赖包
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
- 新增加用户和组
groupadd nginx useradd -g nginx nginx
- 进入/usr/src/php目录下,编译php
[root@localhost php] ./configure --prefix=/usr/local/php7 \
- make && make install
[root@localhost php] make && make install
- 复制移动配置文件:
[root@localhost php] cp /usr/src/php/php.ini-development /usr/local/php7/lib/php.ini [root@localhost php] cp /usr/src/php/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@localhost php] cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf [root@localhost php] cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
- 进入/usr/local/php7目录下,修改php.ini
[root@localhost php7] mkdir tmp [root@localhost php7] chmod -R 777 tmp [root@localhost php7] vim lib/php.ini 修改如下:
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-zts-20151012/" session.save_path = "/usr/local/php7/tmp" date.timezone = PRC
- 添加环境变量:
[root@localhost php7] echo 'export PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH' >> /etc/profile [root@localhost php7] source /etc/profile
- 添加自启动:
[root@localhost php7] chkconfig --add php-fpm [root@localhost php7] chkconfig php-fpm on [root@localhost php7] chkconfig --list php-fpm
- 启动服务:
[root@localhost php7] chmod 777 /etc/init.d/php-fpm [root@localhost php7] /etc/init.d/php-fpm start 启动nginx后,测试发现成功,如下图大功告成:
- 安装新源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
- 安装PHP5.5
yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
- 查看版本
php -v