Hush Framework Framework Configuration (cont.) to the official site of Android and PHP best practices

Source: Internet
Author: User
Tags learn php php server


Book Resources download
    • XAMPP development Environment Download: http://pan.baidu.com/share/link?shareid=531771&uk=773037279
    • Weibo example full source package download: http://pan.baidu.com/share/link?shareid=531769&uk=773037279
    • Hush Framework framework source and related resources download: Http://code.google.com/p/hush-framework/downloads/list
    • For other Android client instances source code please download at the following address: Http://code.google.com/p/android-php/downloads/list

Weibo instance source installation steps (for Windows)

Download the contents of the first two items in the book resource download list.
Unzip the downloaded XAMPP development environment (XAMPP.ZIP) to the D:\XAMPP directory.
Click the Setup_xampp.bat file under the D:\xampp directory, enter 1, and then enter and install the XAMPP.
Add the D:\xampp\php and D:\xampp\mysql\bin directories to the WINDOWS system environment variable Path.
Unzip the downloaded microblog instance full source package (Android-php-source.zip) and copy all files under directory Android-php-source to D:\workspace directory, for example: D:\workspace\ Hush-framework.
Use the httpd-vhosts.conf file under the source directory (D:\workspace) to overwrite the Apache configuration file with the same name in the D:\xampp\apache\conf\extra directory.
Launch Xampp Apache and MySQL on the XAMPP console (D:\xampp\xampp-control.exe).
Open the System command prompt, enter the D:\workspace\hush-framework\hush-app\bin directory, and run the Hush SYS init command to initialize the Hush framework instance.
Open the System command prompt, enter the D:\workspace\android-php-weibo\server\bin directory, and run the "CLI sys init" command to initialize the instance of the microblogging application server.
Modify the Windows system local Hosts file (C:\WINDOWS\system32\drivers\etc\hosts) to include the following virtual site configuration at the end of the file:
Hush Framework Instance Front desk: http://hush-app-frontend
Hush Framework instance background: Http://hush-app-backend
The book Weibo instance API debugging background: http://127.0.0.1:8001
Book Weibo instance WEB site: http://127.0.0.1:8002
Use the ipconfig command to get the local LAN address, such as 192.168.1.28 (you can also directly use the Android Simulator mapping address 10.0.2.2), and then find the server source etc/app.config.php files, as well as the client source code Com.app.demos.base the C.java file in the package, replace 192.168.1.2 with the LAN address (or 10.0.2.2) of the cost machine.
Install the client source code on the Android emulator to run!

Special instructions (to help understand the source code)





Note 1: If you encounter a network issue that causes class library code on Google to fail to download, you can use HUSH/CLI sys uplib to try to download the update, and if you are not successful, you can only download it manually on the Downloads page of the Hush Framework Project site The



Note 2: If you have installed Apache and MySQL services, you should pay attention to the following points:


    • Before you execute the init command "CLI sys init" command, modify the Mysql_user and Mysql_name in bin/cli.php to the user password for local MYSQL.
    • If the Hush Framework cannot import the database, manually import the following two SQL files into the database, and then modify the database configuration file (see next point) doc/sql/.
    • Before you run the system, modify the self in the etc/database.mysql.php configuration file::D Efault_user and self::D efault_pass is the local MySQL user password.





Note 3: The following is a description of the server's main configuration file, which may have a greater advantage in understanding the framework:


    • App.config.php: Entry file for source configuration
    • App.mapping.ini:URL routing configuration file, which is mainly for Debug background
    • database.mysql.php: Database configuration file, where you can manually modify the database user/password
    • global.datamap.php: Protocol configuration file, defining M method to customize the return data structure of the JSON protocol
    • global.defines.php: Global configuration file, primarily used to configure the path of the class library (base/hush class library)
    • global.message.php: Internationalization profile, defining L methods for obtaining internationalized text
    • Global.session.php: Session configuration file, defining the configuration of the server session







Frequently Asked questions (Salon selection)


Question 1: Does the client instance of this book be based on which version of Android is being developed, and is there a problem with the new SDK?



Considering the upward compatibility, all client instances in this book have been developed based on Android2.2. The client instance source code installation process is very simple, only need to import the client instance source code into eclipse, and then set the Android SDK version to Android2.2 version in "Project Properties" to run. Examples of this book have been specially tested, can be normal operation, if you encounter problems in the instance source installation process, please go to the author's blog (Http://blog.csdn.net/shagoo) to ask questions.






Question 2: I am a beginner of Android, can I have some suggestions for learning?



From the perspective of Androider, it is recommended to follow these steps to learn the book:


    1. Read the 2nd Chapter. Android Development Readiness Learn the basics of Android development.
    2. Read Chapters 4 and 52 to learn about the project architecture and planning of this book's Weibo example.
    3. Read the 3rd chapter. PHP Development Readiness Learn the basics of PHP development.
    4. Read the 6th chapter. Service-side development learn to use PHP to develop a service-side interface.
    5. Read the 7th Chapter. Client development Learn how to develop mobile-connected applications in conjunction with the PHP Server API.
    6. Read the 8 to 10 chapters to learn about stress testing and optimization methods for the server and client.
    7. Read the rest of the advanced chapters to learn about Android features, game development, and other extended knowledge.


This book not only allows you to learn the essentials of Android client development, but also learn the popular scripting language PHP usage and server development knowledge, preparation, combat, optimization, advanced content layer progressive, easy-to-go, very suitable for beginners to learn the system. In addition, the content of this book is also very rich, can be used as a reference manual.









Question 3: If only a little PHP, not Android development, how to learn PHP and Android at the same time?



From the perspective of Phper, it is recommended to follow these steps to learn the book:


    1. Read the 3rd chapter. PHP Development Readiness Learn the basics of PHP development.
    2. Read Chapters 4 and 52 to learn about the project architecture and planning of this book's Weibo example.
    3. Read the 6th chapter. Service-side development learn to use PHP to develop a service-side interface.
    4. Read the 2nd Chapter. Android Development Readiness Learn the basics of Android development.
    5. Read the 7th Chapter. Client development Learn how to develop mobile-connected applications in conjunction with the PHP Server API.
    6. Read the 8 to 10 chapters to learn about stress testing and optimization methods for the server and client.
    7. Read the rest of the advanced chapters to learn about Android features, game development, and other extended knowledge.


After all, PHP and Android (Java) are two different languages, when learning to pay attention to the multi-analogy, think more, believe that the road to your programming will be very helpful. In terms of the content of this book, Android and PHP account for about half, more suitable for the mobile internet interested readers to broaden their thinking, of course, if you are interested in architecture, this book is also a good choice.









Question 4: What is the difference between app server development and common Web site development?



Application server development is not exactly the same as developing a normal web site. The most intuitive difference is that the application server is in the form of APIs, and Web sites have interfaces. From the point of view of debugging, the API debugging will be more troublesome, just the PHP service-side framework of the book provides a very convenient debugging framework, interested can be more research ~






Issue 5: How does the database import failure be resolved after running the init command (HUSH/CLI sys init)?





    • Error tip 1: Prompt Can ' t connect to MySQL server on ' 127.0.0.1 '
    • Workaround 1: The reason is that the local MySQL does not start. Make sure the XAMPP MySQL service is started.
    • Error tip 2: Prompt Access denied for user ' root ' @ ' localhost '
    • Workaround 2: The reason is that the MySQL password is incorrect. If you do not want to change the original password, you can modify the database configuration file etc/database.mysql.php, the self::D efault_pass in the file to the existing root password, or directly using Mysqladmin-u root-p Password passwd change the root password to passwd.








Question 6: Why can't the Weibo client connect to the server (prompting "network error")?



First, please confirm whether the local microblogging service has been started, that is, http://127.0.0.1:8001 can access, if possible, please reconfirm the local LAN address (Windows can be obtained using the ipconfig command, For example: 192.168.1.28, or directly using the Android emulator's mapping address 10.0.2.2), and then find the client source Com.app.demos.base package C.java file, will 192.168.1.2 Replace the LAN address (or 10.0.2.2) of the cost machine, and reinstall the client to run the microblog. In addition, it is best to replace the Host_server and Host_website constants in the etc/app.config.php in the server code so that there are no other problems.






Issue 7: Service-side code error Hint: Strict standards:non-static method Mysqlconfig::getinstance () should not be called statically ...?



For alarm messages that conflict with a new version of PHP, update the latest Hush framework code from SVN, or modify the code as follows: 1, find hush/db/config.php, comment out 179 lines, "//abstract public function getinstance (); ". 2. Find etc/database.mysql.php and change 57 lines to "public static function getinstance ()".






Question 8: Why does the "CLI doc build" prompt an error and cannot generate a document?



This is the older problem with the Hush framework version of the book Code (the new version of the Hush framework does not have this problem), can go to the official website of the Downloads Download the micro-blog Instance source code correction package (Weibo-patch-20130502.zip), unzip and overwrite the original source directory (Android-php-weibo) can be.



Hush Framework Framework Configuration (cont.) to the official site of Android and PHP best practices


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.