Thinkphp in the Sina SAE platform deployment example, Thinkphpsae
This paper describes the deployment method of thinkphp on Sina SAE platform. Share to everyone for your reference. The implementation method is as follows:
Thinkphp has been providing SAE platform support since the thinkphp3.0 release, with many features to support localized development and commissioning and deployment switching, allowing Thinkphper to easily transition to SAE development.
First, the preparatory work:
1, you need to have the SAE account, if you do not have the account, please go to the official SAE website application.
2, their own development or to find a program based on thinkphp3.12 development, this test is using the WBlog3.1.3 version of the blog program, there is no click here to download the site.
3, to thinkphp official network download 3.12 version of the SAE engine, and put it into the core package expansion package, SAE engine in the location of the thinkphp package: Thinkphp\extend\engine
Second, the implementation of the steps:
1, create an application, HTTP://127.0.0.1/:
2. Create a version, here I clay 1,:
3, upload the code package, after the full upload code package:
4. Create a database. The path to open the database is w3note»mysql» service Management» Manage MySQL, I create a database name of Wblog, and then import the data table SQL file
5, the configuration before and after the project entry file, the method is similar. Below is the foreground project portal file index.php configuration
Copy the Code code as follows: <?php
Turn on debug mode
Define (' App_debug ', true);
Front Directory
Define (' App_path ', './w3note/');
Define (' W3core_path ', './thinkphp ');
Require W3core_path. ' /extend/engine/sae.php ';//load Sae engine files
6. Database File Configuration
After the database is built, the configuration of the database files, such as Db_host, Db_user, Db_pwd, and Db_name, appears to be generic
Copy CodeThe code is as follows: <?php
// +----------------------------------------------------------------------
// | Wblog
// +----------------------------------------------------------------------
// | Copyright (c) http://www.w3note.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed (http://www.apache.org/licenses/LICENSE-2.0)
// +----------------------------------------------------------------------
// | Author: Net pineapple Fruit
// +----------------------------------------------------------------------
$Id $
if (!defined (' W3core_path ')) exit ();
Return Array (
' Db_type ' = ' mysql ',
' Db_host ' =>sae_mysql_host_m,
' Db_user ' =>sae_mysql_user,
' Db_pwd ' =>sae_mysql_pass,
' Db_name ' =>sae_mysql_db,
' Db_prefix ' = ' wb_ ',
' rbac_role_table ' = ' wb_role ',
' rbac_user_table ' = ' wb_role_user ',
' rbac_access_table ' = ' wb_access ',
' rbac_node_table ' = ' wb_node ',
' KeyCode ' = ' gfgp5o ',
);
?>
It seems to be done here, but the following two points should be noted.
1, SAE strictly case-sensitive
If CSS is changed to CSS style file in path http://127.0.0.1/Public/Css/style.css, load error. However, there is no error in the local test.
2, SAE URL route hidden index.php
If you have a local URL such as Http://127.0.0.1/WBlog/blog hidden index.php, the SAE is not accessible. Reason is
SAE does not support. htaccess files, but we can use the AppConfig service provided by SAE to implement pseudo-static.
In the root directory of your project Config.yaml file (usually automatically generated, not build it yourself), plus the following code:
Handle
-Rewrite:if (!is_dir () &&!is_file () && path~ "^ (. *) $") goto "index.php/$1"
So you can hide the entrance.
It is hoped that this article will be helpful to everyone's thinkphp framework design.
thinkphp How to deploy to SAE
You go to Sina's official website to see, through SVN upload code. There are also some precautions you have to visit the Sina SAE website
thinkphp deployment on the SAE connection database failure how to solve?
Are the databases on the SAE initialized?
http://www.bkjia.com/PHPjc/904007.html www.bkjia.com true http://www.bkjia.com/PHPjc/904007.html techarticle thinkphp on the Sina SAE platform deployment example, Thinkphpsae This article describes the thinkphp on the Sina SAE platform deployment method. Share to everyone for your reference. The concrete implementation method is as follows: ...