centos6.5编译安装安装php-7.2.5.tar.gz

本文档详细介绍了如何在CentOS 6.5上通过编译安装PHP 7.2.5。首先,安装必要的依赖包,然后从php.net下载源代码并解压,执行configure、make和make install命令。接着配置php-fpm和nginx以支持PHP处理,最后启动服务并验证安装成功。
摘要由CSDN通过智能技术生成

1:  准备安装必备工具

   yum -y install make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf\
 kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel\
  gd gd-devel freetype freetype-devel libxml* libxml2-devel zlib zlib-devel \
  glib2 glib2-devel bzip2 bzip2-devel libevent* libevent-devel ncurses ncurses-devel \
  curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel \
  openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel\
  unzip libcap lsof gmp gmp-devel

2:php.net上下载php-7.2.5.tar.gz

    cd /data/soft

    tar -zxvf php-7.2.5.tar.gz

3: cd php-7.2.5

  ./configure --prefix=/usr/local/php7 --with-zlib --enable-xml --with-curl --enable-fpm --with-gd --with-openssl --enable-zip --enable-soap

   make

   make install

4:  mv /usr/local/php7/etc/php-fpm.conf.default /usr/local/php

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
tar zxvf php-5.6.37.tar.gz cd php-5.6.37 #添加组 groupadd www #添加php-fpm用户 useradd -c php-fpm-user -g www -M www # c和c++编译器 yum -y install -y gcc gcc-c++ # PHP扩展依赖 yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --enable-fpm\ --with-fpm-user=www\ --with-fpm-group=www\ --enable-mysqlnd\ --with-mysql=mysqlnd\ --with-mysqli=mysqlnd\ --with-pdo-mysql=mysqlnd\ --enable-opcache\ --enable-pcntl\ --enable-mbstring\ --enable-soap\ --enable-zip\ --enable-calendar\ --enable-bcmath\ --enable-exif\ --enable-ftp\ --enable-intl\ --with-openssl\ --with-zlib\ --with-curl\ --with-gd\ --with-zlib-dir=/usr/lib\ --with-png-dir=/usr/lib\ --with-jpeg-dir=/usr/lib\ --with-gettext\ --with-mhash\ --with-ldap make && make install cp php.ini-production /usr/local/php/etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # 设置php-fpm开机自动启动 chmod +x /etc/init.d/php-fpm chkconfig php-fpm on cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf service php-fpm start 设置php为全局命令: 修改/etc/profile文件使其永久性生效,并对所有系统用户生效, 在文件末尾加上如下两行代码: PATH=$PATH:/usr/local/php/bin //php命令路径 如果还要同时加入mysql 则第一句: PATH=$PATH:/usr/local/php/bin:/usr/local/mysql/bin //路径一定要正确 执行 命令source /etc/profile 使用php -V确认 【查看php-fpm端口】 vim /usr/local/php/etc/php-fpm.conf listen = 127.0.0.1:9000
编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --with-mcrypt=/usr/local/apps/libmcrypt --disable-fileinfo 报错:1, **configure: error: system libzip must be upgraded to version >=**0.11。 使用Yum最新版只到0.10,不足以达到要求。 一、先删除libzip yum remove libzip -y SSH执行以上命令,先删除libzip 和 libzip-devel 二、下载安装并手动编译 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install 三、(可忽略)另外最新版本请参考官网:https://nih.at/libzip/ 1.5.0的libzip需要cmake wget https://libzip.org/download/libzip-1.5.0.tar.gz tar -zxvf libzip-* cd libzip* mkdir build && cd build && cmake .. && make && make install 报错2: error: off_t undefined; check your library configuration 根据报错信息分析 configure: error: off_t undefined; check your library configuration 未定义的类型 off_t。 off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。 采用下面的方法。 添加搜索路径到配置文件 echo '/usr/local
好的,你可以按照以下步骤在CentOS上安装mysql-8.tar.gz版本的MySQL: 1. 首先,下载mysql-8.tar.gz包,可以使用以下命令在终端或命令行工具中进行下载: ``` wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.17-x86_64.tar.gz ``` 注意:以上下载地址是mysql-8.0.25版本的下载地址,如果需要安装其他版本的MySQL,请修改下载地址。 2. 下载完成后,解压mysql-8.tar.gz包,可以使用以下命令进行解压: ``` tar -zxvf mysql-8.0.25-linux-glibc2.17-x86_64.tar.gz ``` 3. 将解压后的mysql-8.0.25-linux-glibc2.17-x86_64目录移动到/usr/local目录下: ``` mv mysql-8.0.25-linux-glibc2.17-x86_64 /usr/local/mysql ``` 4. 进入/usr/local/mysql目录,执行以下命令初始化MySQL: ``` cd /usr/local/mysql bin/mysqld --initialize --user=mysql ``` 5. 修改MySQL配置文件/etc/my.cnf,添加以下内容: ``` [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysql/error.log pid-file=/var/run/mysql/mysql.pid ``` 注意:以上配置文件中的参数可以根据你的需要进行修改。 6. 创建MySQL运行所需的目录: ``` mkdir /var/run/mysql mkdir /var/log/mysql chown -R mysql:mysql /var/run/mysql chown -R mysql:mysql /var/log/mysql ``` 7. 启动MySQL服务: ``` bin/mysqld_safe --user=mysql & ``` 8. 设置root用户密码: ``` bin/mysql_secure_installation ``` 按照提示,设置root用户密码。 9. 远程连接MySQL: ``` bin/mysql -u root -p ``` 输入密码后,即可进入MySQL命令行界面。 至此,你已经成功在CentOS上安装了mysql-8.tar.gz版本的MySQL。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值