SUSE- Apache2+PHP5+Mysql 安裝

SUSE 中本來就自帶 Apache2+PHP5+Mysql
安裝完成後,進行更新,更新完成後。
chkconfig apahce2 on
 
/etc/init.d/apache2 start
 
這時候連接 應該要出現
It works !!!
 
apache2 安裝完後文件存放路徑
/srv/www/htdocs
 
在 /srv/www/htdocs 之下建立
phpinfo.php
----------------------------------------
<?php
echo phpinfo()
?>
----------------------------------------
然後輸入網址
http://127.0.0.1/phpinfo.php
應該會出現以下的畫面
 
在這裡有些要特別注意的資料
 
Configure Command
----------------------------------------------------
'../configure' '--prefix=/usr' '--datadir=/usr/share/php5' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--with-libdir=lib64' '--includedir=/usr/include' '--sysconfdir=/etc/php5/apache2' '--with-config-file-path=/etc/php5/apache2' '--with-config-file-scan-dir=/etc/php5/conf.d' '--with-exec-dir=/usr/lib64/php5/bin' '--enable-magic-quotes' '--enable-libxml' '--enable-session' '--with-mm' '--with-pcre-regex' '--enable-xml' '--enable-simplexml' '--enable-spl' '--enable-safe-mode' '--disable-debug' '--enable-memory-limit' '--enable-inline-optimization' '--enable-zend-multibyte' '--disable-rpath' '--with-apxs2=/usr/sbin/apxs2' '--disable-all' '--disable-cli'
Configuration File (php.ini) Path
-----------------------------------------------------
/etc/php5/apache2/php.ini
 
additional .ini files
-----------------------------------------------------
/etc/php5/conf.d/bcmath.ini, /etc/php5/conf.d/bz2.ini, /etc/php5/conf.d/calendar.ini, /etc/php5/conf.d/ctype.ini, /etc/php5/conf.d/curl.ini, /etc/php5/conf.d/dba.ini, /etc/php5/conf.d/dbase.ini, /etc/php5/conf.d/dom.ini, /etc/php5/conf.d/exif.ini, /etc/php5/conf.d/filepro.ini, /etc/php5/conf.d/ftp.ini, /etc/php5/conf.d/gd.ini, /etc/php5/conf.d/gettext.ini, /etc/php5/conf.d/gmp.ini, /etc/php5/conf.d/iconv.ini, /etc/php5/conf.d/imap.ini, /etc/php5/conf.d/ldap.ini, /etc/php5/conf.d/mbstring.ini, /etc/php5/conf.d/mcrypt.ini, /etc/php5/conf.d/mhash.ini, /etc/php5/conf.d/mysql.ini, /etc/php5/conf.d/mysqli.ini, /etc/php5/conf.d/ncurses.ini, /etc/php5/conf.d/odbc.ini, /etc/php5/conf.d/openssl.ini, /etc/php5/conf.d/pcntl.ini, /etc/php5/conf.d/pdo.ini, /etc/php5/conf.d/pgsql.ini, /etc/php5/conf.d/posix.ini, /etc/php5/conf.d/pspell.ini, /etc/php5/conf.d/shmop.ini, /etc/php5/conf.d/snmp.ini, /etc/php5/conf.d/soap.ini, /etc/php5/conf.d/sockets.ini, /etc/php5/conf.d/sqlite.ini, /etc/php5/conf.d/sysvmsg.ini, /etc/php5/conf.d/sysvsem.ini, /etc/php5/conf.d/sysvshm.ini, /etc/php5/conf.d/tokenizer.ini, /etc/php5/conf.d/wddx.ini, /etc/php5/conf.d/xmlreader.ini, /etc/php5/conf.d/xmlrpc.ini, /etc/php5/conf.d/xsl.ini, /etc/php5/conf.d/zlib.ini
 
 
配置檔 /etc/apache2/httpd.conf
# Overview of include files, chronologically:
#
# httpd.conf
#  |
#  |-- uid.conf  . . . . . . . . . . . . . .  UserID/GroupID to run under
#  |-- server-tuning.conf  . . . . . . . . .  sizing of the server (how many processes to start, ...)
#  |-- sysconfig.d/loadmodule.conf . . . . .  [*] load these modules
#  |-- listen.conf . . . . . . . . . . . . .  IP adresses / ports to listen on
#  |-- mod_log_config.conf . . . . . . . . .  define logging formats
#  |-- sysconfig.d/global.conf . . . . . . .  [*] server-wide general settings
#  |-- mod_status.conf . . . . . . . . . . .  restrict access to mod_status (server monitoring)
#  |-- mod_info.conf . . . . . . . . . . . .  restrict access to mod_info
#  |-- mod_usertrack.conf  . . . . . . . . .  defaults for cookie-based user tracking
#  |-- mod_autoindex-defaults.conf . . . . .  defaults for displaying of server-generated directory listings
#  |-- mod_mime-defaults.conf  . . . . . . .  defaults for mod_mime configuration
#  |-- errors.conf . . . . . . . . . . . . .  customize error responses
#  |-- ssl-global.conf . . . . . . . . . . .  SSL conf that applies to default server _and all_ virtual hosts
#  |
#  |-- default-server.conf . . . . . . . . .  set up the default server that replies to non-virtual-host requests
#  |    |--mod_userdir.conf  . . . . . . . .  enable UserDir (if mod_userdir is loaded)
#  |    `--conf.d/apache2-manual?conf  . . .  add the docs ('?' = if installed)
#  |
#  |-- sysconfig.d/include.conf  . . . . . .  [*] your include files
#  |                                             (for each file to be included here, put its name
#  |                                              into APACHE_INCLUDE_* in /etc/sysconfig/apache2)
#  |
#  `-- vhosts.d/ . . . . . . . . . . . . . .  for each virtual host, place one file here
#       `-- *.conf . . . . . . . . . . . . .     (*.conf is automatically included)
 
 
需要修改的地方
/etc/apache2/mod_mime-defaults.conf
 
在最後一列加入
AddDefaultCharset UTF-8
 
然後存檔
 
還有常常會出現這個問題,出現「Fatal error: Allowed memorysize of 8388608 bytes exhausted」。

發生的原因好像是執行 php 時,佔用了過多的記憶體。所以要將這個設定值改大一點。修改 php.ini 檔案:

    memory_limit = 8M ; 

所以 修改 /etc/php5/apache2
memort_limit = 20M;
 
然後
 
/etc/init.d/apache2 restart
 
 
接下來先處理 mysql 設定
 
Mysql 的配置檔是 /etc/my.cnf
修改 /etc/my.cnf
 
max-allowed-packet=20M
chkconfig mysql on
 
/etc/init.d/mysql start
 
 
設定MySQL 中 root 的密碼 (注意! 此一 root 和 Linux 中的 root 並不是同一個)

mysqladmin -u root password '您要設定給 root 的密碼'

例如:
mysqladmin -u root password 'newpassword'
(嘿... 可不要真的選用這個密碼喔! 這只是舉例而已...)。
'' (兩個上引號是需要的)
連線 MySQL

    # mysql -u root -p 原密碼

    # mysql -u root -p (此方式,會在進入後要求密碼)

#mysql 如果设置了密码后测试方法是-注意的是-p后煤没有空格,直接跟密码)

linuxtest:/usr/local # mysql -u root -ppassword -h localhost
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.26

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

建立連線帳號、權限:

    mysql> grant all privileges on net00db.* to net00@localhost IDENTIFIED BY '12345678' ;
    (表示 localhost 以 net00 帳號,密碼為 12345678 連線者,擁有對資料表:net00db 的所有權限,可以增刪、修改等權利) 

更改密碼

    mysql>set password for net00@localhost = password('1234'); (更改net00@localhost密碼)

    mysql> FLUSH PRIVILEGES ; (系統更新,使改變的部份產生作用。)

刪除權限

    REVOKE priv_type [(column_list)] [, priv_type [(column_list)] ...]
    ON {tbl_name | * | *.* | db_name.*}
    FROM user_name [, user_name ...]

root 密碼忘了,可按照下列方式更正:

    1.先停掉mysql

    # /etc/rc.d/init.d/mysql stop

    2.以--skip-grant-table 的參數啟動mysql

    # safe_mysql --skip-grant-table&

    3. 更改root 密碼
    # mysql mysql
    mysql> UPDATE user SET password=password('newpassword')
    WHERE user='root';
    mysql> FLUSH PRIVILEGES;
    mysql> exit

    4.停掉mysql再重跑
    # mysqladmin -uroot -p shutdown
    Enter password: //輸入新設定的密碼

    # /etc/init.d/mysql start 

修改 apache2 的載入模組 /etc/apache2/sysconfig.d/loadmodule.conf

 
php5 配置檔
 
/etc/php5/apache2/php.ini
 
接下來安裝 phpmyadmin
官方網址: http://www.phpmyadmin.net/home_page/index.php
下載 http://sourceforge.net/projects/phpmyadmin/
 
然後把 phpmyadmin 上傳到 /srv/www/htdocs 目錄之下
用 tar -zxvf 解壓縮  phpmyadmin....tar.gz
 
cd /srv/www/htdocs/phpmyadmin/libries
 
在很多網路的文章中都是教人把  libries/config.default.php 複製到上層,同時改名稱為 config.inc.php,其實,系統執行的時候會先讀取 libraries/config.default.php 作為基本的設定資料,然後再讀取 ./config.inc.php,也就是說 config.inc.php 中止需要放有需要修改的參數就好,不需要把所有的參數都放上去。
 
順應風潮,我們也這樣做吧 ^_^
 
cp config.default.php  ../config.inc.php
 
cd ..
 
不然就直接 cp config.sample.inc.php  config.inc.php
 
不夠的就自己輸入,反正要打的地方不多
 
vi config.inc.php
 
-------------------------------------------------------------
$cfg['PmaAbsoluteUri'] = '';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['DefaultLang'] = 'en-iso-8859-1';
$cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
-------------------------------------------------------------
以下是例子,建議依實際需要自行修改
-------------------------------------------------------------
 
$cfg['PmaAbsoluteUri'] = 'http://127.0.0.1/phpMyAdmin/';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'password';
 
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['DefaultLang'] = 'zh';
$cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
$cfg['Servers'][$i]['extension'] = 'mysqli';
---------------------------------------------------------------
所以,如果沒有特殊設定,其實, config.inc.php 只要放這幾列就可以了
 
完成後開啟 browser 輸入網址
http://127.0.0.1/phpMyAdmin/ 應該就可以見到以下的畫面了
 
 
 
 
大功告成...
本篇引用請注明出處http://blog.chinaunix.net/u/12857/showart.php?id=328761
Thanks a lot....


转载出处: http://blog.chinaunix.net/u/12857/showart_328761.html

你可能感兴趣的:(mysql,PHP,linux,SuSE,Zend)