常見的web服務器:php
httpd(Apache)、nginx+PHPhtml
Tomcat:jsp+htmlmysql
win:IISnginx
客戶端:IE、firefox、chrome、手機瀏覽器(Browser)web
PHP開發環境:LAMP=Linux Apache Mysql PHPsql
或者LNMP=Linux Nginx Mysql PHPchrome
Linux+Apache+Mysql/MariaDB+Perl/PHP/Python數據庫
搭建動態網站之CentOS瀏覽器
yum -y install httpd mariadb mariadb-server php php-mysql服務器
httpd:就是Apache的一個版本
mariadb:MySQL數據庫的客戶端
mariadb-server:服務器端
php-mysql:php操做MySQL
systemctl start httpd:啓動Apache
systemctl enable httpd:設置開機自啓
systemctl start mariadb:啓動數據庫
systemctl enable mariadb:開機自啓
mysqladmin -u root password "123456":設置數據庫帳戶和密碼(默認爲空)
登陸mysql數據庫驗證:mysql -uroot -p123456
網站根目錄:/var/www/html
<?php phpinfo(); ?>
php7.3對MySQL數據庫基本操做之增刪改查:
<?php $server = 'localhost:3306'; $username = 'root'; $password = '123456'; $dbname = 'mydb'; $link = mysqli_connect($server,$username,$password,$dbname); //數據庫鏈接 if($link){ echo "正常!"; }else{ echo "異常!"; } mysqli_set_charset($link,'UTF8'); // 設置數據庫字符集 echo "</br>"; /*$sql = "INSERT INTO users(id,NAME,age,sex) VALUES(5,'zhangsan',18,'male'),(6,'lisi',28,'male')"; //數據庫插入數據 $result = mysqli_query($link,$sql); if($result){ echo "插入成功!"; }else{ echo "插入失敗!"; }*/ /*$sql = "delete from users where id=1"; //刪除數據 $result = mysqli_query($link,$sql); if($result){ echo "刪除成功!"; }else{ echo "刪除失敗!"; }*/ /*$sql = "update users set age=19 where id=4"; //修改數據 $result = mysqli_query($link,$sql); if($result){ echo "修改爲功!"; }else{ echo "修改失敗!"; }*/ $sql = "select * from users"; //查詢數據 $result = mysqli_query($link,$sql); $data = mysqli_fetch_all($result); // 從結果集中獲取全部數據 print_r($data); ?>