程式CODE

2015年8月16日 星期日

CS1.0(SFS4.0)安裝記要

一、準備
1.安裝mongo

2.安裝mongod php extension

3.設定apache virtual host
<VirtualHost *:80>
    ServerName local.cs
    DocumentRoot /home/hami/cloudschool/public
    ErrorLog ${APACHE_LOG_DIR}/cloudschool.error.log
    CustomLog ${APACHE_LOG_DIR}/cloudschool.access.log combined
    # SetEnv APPLICATION_ENV "development"
    <Directory /home/hami/cloudschool/public>
    Require all granted
    AllowOverride All
    # Order allow,deny
   # Allow from 127.0.0.1
    </Directory>
</VirtualHost>


4.加入hosts
127.0.1.1       local.cs

5.加入站台
sudo a2ensite local.cs.conf

6.加入rewrite module
sudo a2enmod rewrite

7.reload restart
sudo service apache2 reload

二、調整
1.複製config檔
複製 local.php.dist  為 local.php
複製 module.doctrine-mongo-odm.local.php.dist  為 module.doctrine-mongo-odm.local.php
複製 application.config.php.dist  為 application.config.php
複製 sfs-upgrade.php.dist  為 sfs-upgrade.php

2.改config/autoload/local.php
<?php
/**
 * Local Configuration Override
 *
 * This configuration override file is for overriding environment-specific and
 * security-sensitive configuration information. Copy this file without the
 * .dist extension at the end and populate values as needed.
 *
 * @NOTE: This file is ignored from Git by default with the .gitignore included
 * in ZendSkeletonApplication. This is a good practice, as it prevents sensitive
 * credentials from accidentally being committed into version control.
 */
$mongo new \MongoClient('mongodb://localhost:27017');
$options new \Zend\Session\SaveHandler\MongoDBOptions(array(
    'database' => 'sfsapp',
    'collection' => 'sessions'
));
$saveHandler new \Zend\Session\SaveHandler\MongoDB($mongo$options);
$manager new \Zend\Session\SessionManager();
$manager->setSaveHandler($saveHandler);
\Zend\Session\Container::setDefaultManager($manager);
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'dbname' => 'school_064630'// 資料庫名稱
                    'user' => 'root'// 資料庫帳號
                    'password' => ''// 資料庫密碼
                    'host' => 'localhost',
                    'port' => 3306,
                    'charset' => 'utf8'
                )
            )
        ),
        'authentication' => array(
            'orm_default' => array(
                // should be the key you use to get doctrine's entity manager out of zf2's service locator
                'objectManager' => 'doctrine.entitymanager.orm_default',
                // fully qualified name of your user class
                'identityClass' => 'Base\Entity\User',
                // the identity property of your class
                'identityProperty' => 'username',
                // the password property of your class
                'credentialProperty' => 'password',
                // a callable function to hash the password with
                'credentialCallable' => 'Base\Entity\User::hashPassword'
            )
        ),
        'migrations_configuration' => array(
            'orm_default' => array(
                'directory' => 'data/migrations',
                'namespace' => 'TravisDoctrineMigrations',
                'table' => 'migrations',
            ),
        ),
    ),


3.sfs3升級設定
<?php
return array(
    // 學制 國民中學或國民小學
    'school_duration' => '國民小學',
     
    // sfs3 資料庫設定
    'olddb' => array(
        'dbname' => 'sfs3',
        'user' => 'root',
        'password' => '',
        'host' => 'localhost',
        'port' => 3306,
        'charset' => 'latin1',
        //'charset' => 'big5',
        'driver' => 'pdo_mysql'
    ),
     
    // 新資料庫設定
    'newdb' => array(
        'dbname' => 'school_064630',
        'user' => 'root',
        'password' => '',
        'host' => 'localhost',
        'port' => 3306,
        'charset' => 'utf8',
        'driver' => 'pdo_mysql'
    )
);

1 則留言:

  1. 作者您好:
    小弟是業餘的資訊愛好者(本身是國中自然科教師),最近看到新的Cloud School已經上線啟用,不知道方不方便向您索取一份原始碼作為個人研究用途,謝謝

    E-mail: garrylai0306@gmail.com

    回覆刪除