失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > linux php环境搭建 图文教程 linux php环境搭建教程

linux php环境搭建 图文教程 linux php环境搭建教程

时间:2020-04-21 11:00:23

相关推荐

linux php环境搭建 图文教程 linux php环境搭建教程

1) 安装依赖包yum -y install wget vim pcre pcre-devel openssl openssl-devel \libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng \libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib \zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel \curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel \nss_ldap jemalloc-devel cmake boost-devel bison automake libevent \libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt \mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel \libcurl libcurl-devel openjpeg-devel libcurl.x86_64 libcurl-devel.x86_64 \libjpeg-turbo libjpeg-turbo-devel libpng freetype libpng-devel \freetype-devel icu libicu libicu-devel openldap openldap-clients \openldap-devel openldap-serverscp -frp /usr/lib64/libldap* /usr/lib/

2) 解压PHP安装包tar zxvf php-7.2.6.tar.gz

3) 编译安装cd php-7.2.6./configure --prefix=/usr/local/server/php \--with-apxs2=/usr/local/server/apache/bin/apxs \--with-config-file-path=/usr/local/server/php \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--enable-mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--enable-mysqlnd-compression-support \--with-iconv-dir \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-zlib \--with-libxml-dir \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-mbstring \--enable-intl \--with-libmbfl \--enable-ftp \--with-gd \--with-openssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--with-gettext \--disable-fileinfo \--enable-opcache \--with-pear \--enable-maintainer-zts \--with-ldap=shared \--without-gdbm \make && make install

2. 配置php.ini1) 将配置文件拷贝到PHP安装目录cp php.ini-* /usr/local/server/php/

2) 生成php.inicp php.ini-development /usr/local/server/php/php.inicp /usr/local/server/php/etc/php-fpm.conf.default /usr/local/server/php/etc/php-fpm.conf

3 ) 修改php.ini配置文件expose_php = Offshort_open_tag = ONmax_execution_time = 300max_input_time = 300memory_limit = 128Mpost_max_size = 32Mdate.timezone = Asia/Shanghaimbstring.func_overload=2extension_dir = "/usr/local/server/php/lib/php/extensions/no-debug-zts-0718/"

3. 修改httpd.conf载入PHP模块,如httpd.conf中有下列代码则直接去掉前面#即可,没有则加入LoadModule php7_module modules/libphp7.so

在底部加入以下代码使得Apache可以解析php文件AddType application/x-httpd-php .php

找到如下代码,在index.html后面加入index.php DirectoryIndex index.html

重启Apacheservice httpd restart

4. 测试PHP是否成功安装创建/usr/local/server/apache/htdocs/index.phpvim /usr/local/server/apache/htdocs/index.php

在index.php中编写以下代码<?php phpinfo();?>

如果出现以下页面则安装成功

MYSQL8.0安装后 phpMyAdmin无法登陆解决

MYSQL8.0的密码验证方式从mysql_native_password改为了caching_sha2_password

vim fdefault_authentication_plugin=mysql_native_password

进入mysql修改一下密码和加密插件use mysql; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'; FLUSH PRIVILEGES;以上就是关于对linux php环境搭建教程的详细介绍。欢迎大家对linux php环境搭建教程内容提出宝贵意见

如果觉得《linux php环境搭建 图文教程 linux php环境搭建教程》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。