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-20170718/"
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. 測(cè)試PHP是否成功安裝創(chuàng)建/usr/local/server/apache/htdocs/index.phpvim /usr/local/server/apache/htdocs/index.php
在index.php中編寫以下代碼<?php phpinfo();?>
如果出現(xiàn)以下頁面則安裝成功
MYSQL8.0安裝后 phpMyAdmin無法登陸解決
MYSQL8.0的密碼驗(yàn)證方式從mysql_native_password改為了caching_sha2_password
vim my.cnfdefault_authentication_plugin=mysql_native_password
進(jìn)入mysql修改一下密碼和加密插件use mysql; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'; FLUSH PRIVILEGES;以上就是關(guān)于對(duì)linux php環(huán)境搭建教程的詳細(xì)介紹。歡迎大家對(duì)linux php環(huán)境搭建教程內(nèi)容提出寶貴意見
總結(jié)
以上是生活随笔為你收集整理的linux php环境搭建 图文教程,linux php环境搭建教程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 央行放大招,网贷新规正式出台,以后恐怕不
- 下一篇: 信用卡审核会问什么 信用卡审核问什么问题