Solaris apache2 php

設定、測試與啟動 Apache2
Solaris 10 已經內置安裝了 Apache 2.xx,只需要做一些設定便可以使用。
1. 首先用 Root 了登入文字模式系統 ( Console Mode )
2. 複制 /etc/apache2/httpd.conf-example 到 /etc/apache2/httpd.conf
# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf
3. 編輯 /etc/apache2/httpd.conf

  • 設定你所需要的 ServerName 伺服器名稱,預設為 127.0.0.1
  • 在 ServerAdmin 設定正確的 E-mail 地址
  • 4. 使用以下指令啟動 Apache

# svcadm enable apache2

然後,試一試從新啟動 Solaris ,看一看 Apache 能不自動啟動。基本網頁文件位置為 /var/apache2/htdocs 。

設定、測試與啟動 MySQL

Solaris 10 已經內置安裝了 MySQL。安裝者必須要用 Root 身份登入系統。以下的安裝步驟可以在 /usr/sfw/src/mysql/Docs 目錄中找到。

  1. 用 root 身份 login 到 Console mode 中,並且進行資料庫的事前準備。

    # /usr/sfw/bin/mysql_install_db
    Preparing db table
    Preparing host table
    Preparing user table
    Preparing func table
    Preparing tables_priv table
    Preparing columns_priv table
    Installing all prepared tables
    060118 21:24:03 /usr/sfw/sbin/mysqld: Shutdown Complete
    <snip...>
     
  2. 建立 mysql user 和 group ,並且更改資料目錄的群組。

    # groupadd mysql
    # useradd -g mysql mysql
    # chgrp -R mysql /var/mysql
    # chmod -R 770 /var/mysql
    # installf SUNWmysqlr /var/mysql d 770 root mysql
     
  3. 預設 MySQL 設定檔位置為 /var/mysql/my.cnf
  4. 複制 MySQL 設定檔到預設位置

    # cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf
     
  5. 手動啟動 mysql

    # /usr/sfw/sbin/mysqld_safe --user=mysql &
     
  6. 設定 MySQL 的 root user密碼 ( 下文中的 new-password 為你想要的密碼,你可以自行更改為你喜歡的密碼。因為安全理由,切密不要使用 new-password 為你的密碼,一定要更改 )

    # cd /usr/sfw/bin
    # ./mysqladmin -u root password 'new-password'
    # ./mysqladmin -u root -h `hostname` password 'new-password'
     
  7. 測試 MySQL Server

    # ./mysqlshow -p
    Enter password: new-password

    +-----------+
    | Databases |
    +-----------+
    | mysql     |
    | test      |
    +-----------+

    # ./mysql -u root -p
    Enter password: new-password

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 3 to server version: 4.0.20-standard
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> show databases;
    +-----------+
    | Databases |
    +-----------+
    | mysql     |
    | test      |
    +-----------+
    2 rows in set (0.00 sec)

    mysql> quit;
    Bye
     
  8. 設定 Solaris Server 在啟動和關機時,自動運行和停止MySQL Server。

    # ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
    # ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
    # ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
    # ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql
    # ln /etc/sfw/mysql/mysql.server /etc/rcS.d/K00mysql 
  9. 然後,試一試從新啟動 Solaris ,看一看 MySQL 能不自動啟動。預設 MySQL 設定檔位置為 /var/mysql/my.cnf 。
  10. 下載與設定 PHP

  11. 用 root 身份 login 到 Console mode 中。
  12. 如果系統中沒有這個檔案 /etc/apache2/httpd.conf
    root:/# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf

    編輯 /etc/apache2/httpd.conf

    • 設定你所需要的 ServerName 伺服器名稱,預設為 127.0.0.1
    • 在 ServerAdmin 設定正確的 E-mail 地址
  13. 下載php-5.2.1
    usr/local/src# cp php-5.1.2.tar.gz ..
    root:/usr/local/src# cd ..
    root:/usr/local# gunzip -cd php-5.1.2.tar.gz | gtar xvpf -
    ...
    root:/usr/local# cd php-5.1.2
    root:/usr/local/php-5.1.2# ./configure --with-apxs2=/usr/apache2/bin/apxs \
    --with-mysql=/usr/sfw/ --enable-dbase --with-libxml-dir=/usr/slocal \
    --with-config-file-path=/etc/apache2 --with-gd-dir=/opt/sfw/bin \
    --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib --enable-mbstring

    ...
    root:/usr/local/php-5.1.2# make
    ...
    root:/usr/local/php-5.1.2# make install 
  14. root:/usr/local/php-5.1.2# cp php.ini-dist /etc/apache2/php.ini 
  15. 進入 apache2 設定文件目錄
    root:/usr/local/php-5.1.2# cd /etc/apache2
    root:/etc/apache2#
如果要設定其它 php 的選項,請編輯 /etc/apache2/php.ini 編輯 httpd.conf 文件

安裝完 php 後,php 會在 /etc/apache2/httpd.conf 內加入以下句子,請檢查清楚,這句子是否存在:
LoadModule php5_module libexec/libphp5.so
請在 /etc/apache2/httpd.conf 的最後一行手動加入以下句子:
AddType application/x-httpd-php .php 啟動 Apache2 和 測試
# svcadm enable apache2
# svcs | grep -i apache2
online 18:07:10 svc:/network/http:apache2  然後,試一試從新啟動 Solaris ,看一看 Apache2 能不自動啟動。如果不能自動啟動,而只能手動啟動,請看清楚第 19項的說明。
預設 Apache2 設定檔位置為 /etc/apach2/httpd.conf 。
  1. root:/usr/local/php-5.1.2# cp php.ini-dist /etc/apache2/php.ini
  2. root:/usr/local/php-5.1.2# 
  3. 進入 apache2 設定文件目錄
    root:/usr/local/php-5.1.2# cd /etc/apache2
    root:/etc/apache2#
  4. 如果要設定其它 php 的選項,請編輯 /etc/apache2/php.ini
  5. 編輯 httpd.conf 文件
    安裝完 php 後,php 會在 /etc/apache2/httpd.conf 內加入以下句子,請檢查清楚,這句子是否存在:
    LoadModule php5_module libexec/libphp5.so
    請在 /etc/apache2/httpd.conf 的最後一行手動加入以下句子:
    AddType application/x-httpd-php .php 
  6. 啟動 Apache2 和 測試
    # svcadm enable apache2
    # svcs | grep -i apache2
    online 18:07:10 svc:/network/http:apache2 
  7. 然後,試一試從新啟動 Solaris ,看一看 Apache2 能不自動啟動。如果不能自動啟動,而只能手動啟動,請看清楚第19項的說明。
    預設 Apache2 設定檔位置為 /etc/apach2/httpd.conf 。

转载于:https://my.oschina.net/threefishes/blog/332

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值