Table of Contents
- 1. WebApp Directory structure
- 2. Sample App
- 3. Dreamhost servers
- 4. Offline
- 5. Crazy Maik
- 6. Actions and Commands
- 7. session fragment
- 8. Network
- 9. functionality
- 10. printing
- 11. HitiPPR_GetPrinterInfo
- 12. PrintingPhotoUtility
- 13. Network Discovery
- 14. update yii apps
- 15. ACT I. Scene I. Verona. A...
- 16. Scene II. A Street.
- 17. Scene III. Capulet's house.
- 18. Scene IV. A street.
- 19. Scene V. Capulet's house.
- 20. PROLOGUE
- 21. ACT II. Scene I. A lane b...
- 22. Scene II. Capulet's orchard.
- 23. Scene III. Friar Laurence...
- 24. Scene IV. A street.
- 25. Scene V. Capulet's orchard.
- 26. Scene VI. Friar Laurence'...
- 27. ACT III. Scene I. A publi...
- 28. Scene II. Capulet's orchard.
- 29. Scene III. Friar Laurence...
- 30. Scene IV. Capulet's house
- 31. Scene V. Capulet's orchard.
- 32. ACT IV. Scene I. Friar La...
- 33. Scene II. Capulet's house.
- 34. Scene III. Juliet's chamber.
- 35. Scene IV. Capulet's house.
- 36. Scene V. Juliet's chamber.
- 37. ACT V. Scene I. Mantua. A...
- 38. Scene II. Verona. Friar L...
WebApp Directory structure
Let us use www.openbook.pub
as an illustration of the preferred structure of PHP
WebApps, built upon the Yii Framework. The WebApp has an old version 1.8.2
, a current version 2.0.1
, while version 2.1
is currently under development.
/openbook.pub/
/openbook.pub/index.php
/openbook.pub/ad5min_.php
/openbook.pub/...
/mydevsite.com/
/mydevsite.com/index.php
/mydevsite.com/ad5min_.php
/mydevsite.com/...
/openbook.app/
/openbook.app/1.8.2/
/openbook.app/1.8.2/frontend/
/openbook.app/1.8.2/backend/
/openbook.app/1.8.2/common/
/openbook.app/1.8.2/vendor/
/openbook.app/1.8.2/.git/
/openbook.app/2.0.1/frontend/
/openbook.app/2.0.1/backend/
/openbook.app/2.0.1/common/
/openbook.app/2.0.1/vendor/
/openbook.app/2.0.1/.git/
/openbook.app/2.3/
The entry scripts are very simple. The public will access the frontend via /openbook.pub/index.php
require_once (dirname(__DIR__)./openbook.app/2.0.1/frontend/web/production.php');
Maintenance can be done by the administrator on the backend via /openbook.pub/ad5min.php
. We have chosen the odd ad5min_.php
filename to make the entry harder to guess for hackers.
require_once (dirname(__DIR__)./openbook.app/2.0.1/backend/web/production.php');
Development is done via /mydevsite.com/index.php
require_once (dirname(__DIR__)./openbook.app/2.3/frontend/web/development.php');
Each version of the webapp is complete and independent of other versions. It has its own vendor/
with the Yii framework and other dependencies. Once the version has been published vendor/
will remain unchanged.
Each version also has its own git
registry. It can be changed and committed without affect other versions.
The above structure achieves the following
- Development, testing and production run on the same server.
- DT&P are separated as to never interfere.
- It is easy and to upgrade to a next version, or even to revert back to a previous version.
Note that frontend and backend are two separated webapps. When possible, they will share code in common/
. But a LoginForm.php
may be different, and each will have it in their own models/
.
On the other hand, the differences between running an app in development or production mode are limited.
production.php
versusdevelopment.php
as entry script.- These entry scripts will set different values for environment variables like
YII_ENV_DEV
. - These entry script will include identical
config/params.php
files, but they may configure differently perif-ten-else
statements. - No other differences; the modes share identical code.
A bare-bones sample application may be copied from /x0data.app/1.0
. For example by cp -r x0data.app/1.0 riverbankneighborhood.app/2.0
. The Yii manual specifies the following to-do list for this bare-bones webapp:
- Create a new database and adjust the components['db'] configuration in common/config/main-local.php accordingly.
- Apply migrations with console command yii migrate.
- Set document roots of your web server: for frontend /path/to/yii-application/frontend/web/ and using the URL http://frontend/ for backend /path/to/yii-application/backend/web/ and using the URL http://backend/ (We will not set the document roots because we have chosen a different structure; as per above.)
