php零基础教程
一 PHP基础1.1 服务器配置4核CPU、8G内存100G磁盘空间,操作系统:CentOS7.81.2 下载地址https://www.php.net/downloads.php二 游戏PHP安装2.1 下载安装包到指定路径
cd /webwget https://www.php.net/distributions/php-8.1.6.tar.gz2.2 解压缩安装包tar xf ph游戏p-8.1.6.tar.gz2.3 安装依赖
yum install libxml2-devel sqlite-devel bzip2-devel libcurl-devel libpng-devel 游戏libjpeg-devel freetype-devel libicu-devel libxslt-devel ibzip-devel dnf oniguruma-devel -y
2.4 编译cd p游戏hp-8.1.6./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl -游戏-with-freetype --enable-gd --with-jpeg --with-gettext --with-kerberos --with-libdir=lib64 --with-lib游戏xml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --w游戏ith-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --enable-fpm --e游戏nable-pdo --enable-bcmath --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enabl游戏e-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --with-xmlrpc --with-ldap --ena游戏ble-sysvsem --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-m游戏ysqlnd
报错1:
yum install openldap openldap-devel -y重新编译报错2:
原因:mbstring的正则功能需要oniguruma的支持,系统中却没有oniguru游戏ma库解决:使用源码安装oniguruma库cd /webwget https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/on游戏ig-6.9.5-rev1.tar.gz -O onig-6.9.5.tar.gz。
tar xf onig-6.9.5.tar.gzcd onig-6.9.5./configure --prefix=游戏/usr --libdir=/lib64make && make install再次重新编译
cd /web/php-8.1.6报错3:
解决方案:yum remove libzip-devel libz游戏ipcd /webwget https://libzip.org/download/libzip-1.3.2.tar.gz --no-check-certificate
tar xf libzip-1.游戏3.2.tar.gzcd libzip-1.3.2./configuremake && make installecho export PKG_CONFIG_PATH="/usr/local/lib/游戏pkgconfig/" >>/etc/profile
source /etc/profile再次重新编译phpcd /web/php-8.1.6编译完成
2.5 安装make && make instal游戏l此步骤时间较长,我这边在安装的时候用时35分钟左右,需要耐心等待...2.6 生成php.ini配置文件cp php.ini-production /usr/local/php/etc/php.in游戏i
2.7 生成www配置文件cd /usr/local/php/etc/php-fpm.d/ cp www.conf.default www.conf2.8 生成php-fpm配置文件cd /usr/游戏local/php/etc/
cp php-fpm.conf.default php-fpm.conf2.9 生成php-fpm可执行文件mkdir /usr/local/php/fpmcp /web/游戏php-8.1.6/sapi/fpm/init.d.php-fpm /usr/local/php/fpm/php-fpm
2.10 配置环境变量echo export PATH=$PATH:/usr/l游戏ocal/php/bin:/usr/local/php/sbin >>/etc/profilesource /etc/profile
2.11 查看版本php --version
2.12 查看安装的扩展游戏php -m2.13 启动php服务php-fpm start2.14 查看服务状态ps -ef|grep php
至此,PHP安装完成,感谢观看,如果对您有帮助,请动动小手点点关注,点点赞,一起努力加游戏油吧。
亲爱的读者们,感谢您花时间阅读本文。如果您对本文有任何疑问或建议,请随时联系我。我非常乐意与您交流。
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。