CentOS7安装PHP
下载
1 | wget https://www.php.net/distributions/php-8.0.0.tar.gz |
解压
1 | tar -zxvf php-8.0.0.tar.gz |
依赖安装
1 | yum -y install gcc openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel sqlite-devel |
报错1
1 | configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met: |
1 | yum install libicu-devel |
报错2
1 | configure: error: Cannot find libtidy |
1 | yum install -y libtidy-devel |
编译
1 | ./configure --prefix=/usr/local/php/php-8.0.0-win32-x64-thread-safe --with-config-file-path=/usr/local/php/php-8.0.0-win32-x64-thread-safe/etc --enable-fpm --enable-mysqlnd --enable-opcache --enable-pcntl --enable-mbstring --enable-soap --enable-calendar --enable-bcmath --enable-exif --enable-ftp --enable-intl --with-mysqli --with-pdo-mysql --with-openssl --with-curl --with-gettext --with-mhash --with-openssl --with-tidy --with-zlib |
安装
1 | make |
1 | make install |
在[/etc/profile]文件中加上以下内容
1 | export PHP_HOME=/usr/local/php/php-8.0.0-win32-x64-thread-safe |
验证
1 | php -v |