湖濱散記部落格的樹心幽徑[login][主頁]
447:20181217在Ubuntu1604-Linux裝apache2 web server 和 php 7,並設計m1.php資料庫連線查詢程式

(1) treehrt@treehrt-BM6AE-BM1AE-BP1AE:~$ sudo apt-get install apache2
:

下列的額外套件將被安裝:
  apache2-bin apache2-data apache2-utils libaprutil1-dbd-sqlite3
  libaprutil1-ldap
建議套件:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
下列【新】套件將會被安裝:
  apache2 apache2-bin apache2-data apache2-utils libaprutil1-dbd-sqlite3
  libaprutil1-ldap
升級 0 個,新安裝 6 個,移除 0 個,有 455 個未被升級。
需要下載 1,342 kB 的套件檔。
此操作完成之後,會多佔用 5,346 kB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
:

取得 1,342 kB 用了 7秒 (189 kB/s)                                             
選取了原先未選的套件 libaprutil1-dbd-sqlite3:i386。
(讀取資料庫 ... 目前共安裝了 317470 個檔案和目錄。)
準備解開 .../libaprutil1-dbd-sqlite3_1.5.4-1build1_i386.deb ...
解開 libaprutil1-dbd-sqlite3:i386 (1.5.4-1build1) 中...
選取了原先未選的套件 libaprutil1-ldap:i386。
準備解開 .../libaprutil1-ldap_1.5.4-1build1_i386.deb ...
解開 libaprutil1-ldap:i386 (1.5.4-1build1) 中...
選取了原先未選的套件 apache2-bin。
準備解開 .../apache2-bin_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2-bin (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2-utils。
準備解開 .../apache2-utils_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2-utils (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2-data。
準備解開 .../apache2-data_2.4.18-2ubuntu3.9_all.deb ...
解開 apache2-data (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2。
準備解開 .../apache2_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2 (2.4.18-2ubuntu3.9) 中...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.35-0ubuntu2) ...
設定 libaprutil1-dbd-sqlite3:i386 (1.5.4-1build1) ...
設定 libaprutil1-ldap:i386 (1.5.4-1build1) ...
設定 apache2-bin (2.4.18-2ubuntu3.9) ...
設定 apache2-utils (2.4.18-2ubuntu3.9) ...
設定 apache2-data (2.4.18-2ubuntu3.9) ...
設定 apache2 (2.4.18-2ubuntu3.9) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...

 

(2)

$ sudo systemctl start apache2

$ sudo systemctl enable apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable apache2

(3)

$ sudo systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since 一 2018-12-17 20:19:15 CST; 2min 38s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/apache2.service
           ├─4771 /usr/sbin/apache2 -k start
           ├─4774 /usr/sbin/apache2 -k start
           └─4775 /usr/sbin/apache2 -k start

12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Starting LSB: Apache2 web server...
12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]:  * Starting Apache httpd web server apache2
12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally
12月 17 20:19:15 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]:  *
12月 17 20:19:15 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Started LSB: Apache2 web server.
12月 17 20:20:43 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Started LSB: Apache2 web server.

(4) http://localhost/ 成功看到預設網頁


select id,article_id,topic,text from lt_articles_text where article_id =447; ok. update lt_articles set num_reads=num_reads +1 where id=447; ok.