Fedora 17 PHP编程环境配置
一、安裝 Mysql和Mysql-Server
# yum install mysql mysql-server ================================================================================Package 架構 版本 倉庫 大小 ================================================================================ 正在安裝:mysql i686 5.5.23-1.fc17 fedora 4.5 Mmysql-server i686 5.5.23-1.fc17 fedora 8.2 M 為依賴而安裝:libaio i686 0.3.109-5.fc17 fedora 22 kperl-AnyEvent noarch 5.27-7.fc17 fedora 319 kperl-AnyEvent-AIO noarch 1.1-8.fc17 fedora 8.4 kperl-AnyEvent-BDB noarch 1.1-7.fc17 fedora 8.4 kperl-Async-MergePoint noarch 0.03-7.fc17 fedora 19 kperl-BDB i686 1.88-5.fc17 fedora 72 kperl-Coro i686 6.07-3.fc17 fedora 246 kperl-Curses i686 1.28-5.fc17 fedora 86 kperl-DBD-MySQL i686 4.020-2.fc17 fedora 140 kperl-DBI i686 1.617-1.fc17 fedora 781 kperl-EV i686 4.03-8.fc17 fedora 251 kperl-Event i686 1.20-1.fc17 fedora 280 kperl-Event-Lib i686 1.03-16.fc17 fedora 50 kperl-Glib i686 1.241-2.fc17 fedora 348 kperl-Guard i686 1.022-1.fc17 fedora 18 kperl-Heap noarch 0.80-10.fc17 fedora 46 kperl-IO-AIO i686 4.15-1.fc17 fedora 112 kperl-IO-Async noarch 0.29-7.fc17 fedora 160 kperl-IO-Tty i686 1.10-5.fc17 fedora 39 kperl-POE noarch 1.350-2.fc17 fedora 583 kperl-Socket-GetAddrInfo i686 0.19-1.fc17 fedora 32 kperl-Socket6 i686 0.23-8.fc17 fedora 22 kperl-TermReadKey i686 2.30-14.fc17 fedora 29 kperl-common-sense noarch 3.5-1.fc17 fedora 26 k事務概要 ================================================================================ 安裝 2 軟件包 (+24 Dependent packages)總下載量:16 M 安裝大小:81 M 確定嗎?[y/N]:然后就是下載安裝了。
- 完畢后打開服務
先來看下當前的端口情況:
# netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:55387 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:7070 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 :::58520 :::* LISTEN tcp6 0 0 ::1:7070 :::* LISTEN tcp6 0 0 :::111 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::631 :::* LISTEN然后開啟服務
# systemctl start mysqld.service# systemctl enable mysqld.service
再來看看又增加了哪個端口?
# netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:55387 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:7070 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 :::58520 :::* LISTEN tcp6 0 0 ::1:7070 :::* LISTEN tcp6 0 0 :::111 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::631 :::* LISTENYes!這個3306 就是mysql的端口了。
更改mysql用戶root的密碼
# mysqladmin -u root password 新密碼- 檢查數據庫連接
以上省略部分內容,看到這個就表示mysql連接成功了。要退出mysql怎么辦?在mysql>后輸入\q
二、安裝HTTPD 和? PHP
#yum install httpd php php-common =============================================================================Package 架構 版本 倉庫 大小 ============================================================================= 正在安裝:httpd i686 2.2.22-4.fc17 fedora 825 kphp i686 5.4.3-1.fc17 updates 2.6 Mphp-common i686 5.4.3-1.fc17 updates 805 k 為依賴而安裝:apr i686 1.4.6-1.fc17 fedora 105 kapr-util i686 1.4.1-2.fc17 fedora 80 kapr-util-ldap i686 1.4.1-2.fc17 fedora 17 khttpd-tools i686 2.2.22-4.fc17 fedora 75 klibzip i686 0.10.1-1.fc17 fedora 46 kphp-cli i686 5.4.3-1.fc17 updates 2.5 M事務概要 ============================================================================= 安裝 3 軟件包 (+6 Dependent packages)總下載量:7.0 M 安裝大小:25 M 確定嗎?[y/N]:- 安裝后啟動httpd的服務
啟動前先看看當前的端口:
# netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:55387 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:7070 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 :::58520 :::* LISTEN tcp6 0 0 ::1:7070 :::* LISTEN tcp6 0 0 :::111 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::631 :::* LISTEN然后啟動httpd的服務:
# service httpd start啟動后再看下端口,發現80的端口打開了。
# netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:55387 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:7070 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 :::58520 :::* LISTEN tcp6 0 0 ::1:7070 :::* LISTEN tcp6 0 0 :::111 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::631 :::* LISTEN- 讓Apache隨電腦一起啟動吧!
- 然后在瀏覽器里輸入http://localhost/就可以看到Apache的頁面了。
Apache安裝成功!
三、安裝PHP模塊
#yum install php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
這2行可以寫在一起的,只是因為它太長了,所以將其分為2行。 =============================================================================Package 架構 版本 倉庫 大小 ============================================================================= 正在安裝:php-gd i686 5.4.3-1.fc17 updates 130 kphp-mbstring i686 5.4.3-1.fc17 updates 507 kphp-mcrypt i686 5.4.3-1.fc17 updates 39 kphp-mysql i686 5.4.3-1.fc17 updates 117 kphp-pdo i686 5.4.3-1.fc17 updates 113 kphp-pear noarch 1:1.9.4-7.fc17 fedora 372 kphp-pecl-apc i686 3.1.10-1.fc17 fedora 133 kphp-pecl-memcache i686 3.0.6-3.fc17 fedora 59 kphp-pecl-memcached i686 2.0.1-3.fc17 fedora 54 kphp-pecl-mongo i686 1.2.10-1.fc17 updates 83 kphp-pgsql i686 5.4.3-1.fc17 updates 94 kphp-xml i686 5.4.3-1.fc17 updates 152 k 為依賴而安裝:libmcrypt i686 2.5.8-11.fc17 fedora 95 klibmemcached i686 1.0.4-1.fc17 fedora 176 kphp-pecl-igbinary i686 1.1.2-0.2.git3b8ab7e.fc17 fedora 40 kpostgresql-libs i686 9.1.3-3.fc17 fedora 213 kt1lib i686 5.1.2-9.fc17 fedora 152 k事務概要 ============================================================================= 安裝 12 軟件包 (+5 Dependent packages)總下載量:2.5 M 安裝大小:9.6 M 確定嗎?[y/N]:
- 安裝好后檢查一下看能否顯示php頁面:
- 在瀏覽器地址欄輸入http://localhost/info.php即可看到剛才建立的info.php頁面。
PHP安裝成功!
四、最后一步我們來安裝PhpMyAdmin
# yum install phpmyadmin ================================================================================Package 架構 版本 倉庫 大小 ================================================================================ 正在安裝:phpMyAdmin noarch 3.5.1-1.fc17 updates 4.0 M 為依賴而安裝:php-php-gettext noarch 1.0.11-5.fc17 fedora 21 k事務概要 ================================================================================ 安裝 1 軟件包 (+1 Dependent package)總下載量:4.0 M 安裝大小:17 M 確定嗎?[y/N]:- 安裝好后重啟Apache:
- 查看phpMyadmin頁面
在瀏覽器地址欄輸入http://localhost/phpmyadmin/可看到mysql的圖形化界面了。
?
最后把mysql里的空用戶和test數據庫刪除掉
# mysql -u root -p mysql> DELETE FROM mysql.user WHERE user =''; mysql> drop database test;?(\G) Send command to mysql server, display result vertically.
sql語句后面加上\G 是將結果豎直顯示。
?
Congratulations!Fedora 17里的PHP環境操作結束。你可以開始PHP開發之旅了,Go!
http://www.unixmen.com/201205-howto-install-lamp-in-fedora/
轉載于:https://www.cnblogs.com/ibgo/archive/2012/06/02/2532349.html
總結
以上是生活随笔為你收集整理的Fedora 17 PHP编程环境配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: plsql查询中补入空行--做报表分页挺
- 下一篇: SHA算法原理与常用实现方式是什么