PHP安裝__GongWei1997
PHP安裝
準備安裝包
php-7.1.10.tar.bz2
安裝流程
# yum安裝 解決依賴關係
yum -y install \
libjpeg \
libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 \
libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel
# 解壓縮
tar -jxvf php-7.1.10.tar.bz2
# 配置編譯環境
php-7.1.10]# ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
# 編譯安裝
make && make install
cp php.ini-development /usr/local/php/lib/php.ini
# 修改PHP配置檔案
vi /usr/local/php/lib/php.ini
mysqli.default_socket = /usr/local/mysql/mysql.sock #搜尋/mysqli.default後,修改
date.timezone = Asia/Shanghai #搜尋/date.time後,去除“;”,然後修改(PHP文字里的“;”是註釋的意思)
# 驗證php模組是否安裝成功
/usr/local/php/bin/php -m
# 讓apche支援PHP
vi /etc/httpd.conf //在合適位置新增
#搜尋/AddType後新增
AddType application/x-httpd-php .php //新增.php應用和功能
AddType application/x-httpd-php-source .phps //新增.phps應用和功能
#搜尋/DirectoryIndex後在“index.php”前新增“index.php”
DirectoryIndex index.php index.html //預設主頁,優先使php主頁
vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
systemctl restart httpd
netstat -anpt | grep httpd
systemctl status httpd //出現active,即正常
# 驗證結果
主機訪問網址:http://20.0.0.14#出現PHP主頁(前面指令碼設定了優先)
http://20.0.0.15/index.html #訪問apache主頁
#進入資料庫
mysql -uroot -pqweasd
create database mydam; //建立一個叫“mydam”的庫
grant all privileges on mydam.* to 'mydam'@'localhost' identified by 'qweasd';
grant all privileges on mydam.* to 'mydam'@'%' identified by 'qweasd';
flush privileges;
exit
vi /usr/local/httpd/htdocs/index.php
<?php
$link=mysqli_connect('20.0.0.14','myadm','qweasd'); //用php訪問資料庫
if($link) echo "<h1>OK</h1>";
else echo "NO";
?>
安裝phpMyadmin
unzip phpMyAdmin-4.7.6-all-languages.zip
mv phpMyAdmin-4.7.6-all-languages /usr/local/httpd/htdocs/myadm
cd /usr/local/httpd/htdocs/myadm
cp config.sample.inc.php config.inc.php
vi config.inc.php
$cfg['Servers'][$i]['host'] = '20.0.0.14’;//把localhost改成IP
#進入資料庫
mysql -uroot -pqweasd
grant all privileges on *.* to 'root'@'client1' identified tified by '123456';
flush privileges;
#瀏覽器訪問20.0.0.14/myadm即可
相關文章
- linux 安裝yum 安裝phpLinuxPHP
- 安裝 PHP 8.0PHP
- docker 安裝 PHPDockerPHP
- yum 安裝 PHPPHP
- PHP-安裝-PHP7.4PHP
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- linux + php 安裝curlLinuxPHP
- PHP Linux安裝擴充套件(編譯安裝)PHPLinux套件編譯
- 安裝php出現make: *** [sapi/cli/php]PHPAPI
- php以及php擴充套件memcache 安裝PHP套件
- PHP 擴充套件安裝PHP套件
- Mac 安裝 PHP7.2MacPHP
- (MAC) PHP安裝和配置MacPHP
- php常用外掛安裝PHP
- CentOS 7 安裝PHP 5.4.16CentOSPHP
- centos PHP 編譯安裝CentOSPHP編譯
- ubuntu 安裝php8.0UbuntuPHP
- php 安裝zip模組PHP
- httpd編譯安裝phphttpd編譯PHP
- ubuntu 安裝php7.1UbuntuPHP
- CentOS 7 安裝 PHP 7.2CentOSPHP
- 安裝PHP ImageMagick筆記PHP筆記
- ubuntu 安裝php7.2UbuntuPHP
- php5.6.34安裝XdebugPHP
- PHP:php7.2.3 安裝pcntl 擴充套件PHP套件
- 【PHP】php安裝bcmath擴充套件指令碼PHP套件指令碼
- Ubuntu安裝Lighttpd、PHP和MariaDBUbuntuhttpdPHP
- PHP的Imagick擴充安裝PHP
- PHP:windows安裝AMQP擴充PHPWindowsMQ
- php mysql擴充套件安裝PHPMySql套件
- php amqp擴充套件安裝PHPMQ套件
- PHP 安裝 yaconf 擴充套件PHP套件
- PHP7 編譯安裝PHP編譯
- (MAC) PHP擴充套件安裝MacPHP套件
- Laradock php mysql 安裝多版本PHPMySql
- PHP安裝redis擴充套件PHPRedis套件
- 原始碼安裝Nginx和PHP原始碼NginxPHP
- centos7下安裝phpCentOSPHP