-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
91 lines (60 loc) · 3.14 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
QuickIntroduction :-
NanoPHP has been designed for rapid development of PHP based projects. It utilises most of the new features 5.3.2+ has to offer.
Requirements :-
MySQL 5.1 +
Apache 2
- mod_rewrite enabled
- mod_headers enabled (optional)
PHP 5.3.2 +
- MySqli Extension (PHP 5 Mysql)
- xdebug (optional - recommended)
- memcached (optional - recommended)
Installation :-
1.) Run the SQL code in sql/nanophp_structure.sql
2.) Edit site/config/environments/Dev.class.php
----------------------------------------------------------------------------------------------------------------------------
'databases' => array (
'default' => array(
'mode' => \site\core\db\core\Database::DB_MODE_SINGLE, //.only mode currently supported
'name' => 'nanophp', //.database name
'servers' => array(
array(
'host' => 'localhost', //.database hostname/ip
'port' => '3306', //.database port
'user' => 'root', //.database username
'pass' => 'test' //.database password
)
)
)
),
----------------------------------------------------------------------------------------------------------------------------
3.) Check your details are correct to access the MySQL database.
4.) In web/.htaccess towards the bottom there should be two access rules:
----------------------------------------------------------------------------------------------------------------------------
# ####### Dev ##########
RewriteCond %{HTTP_HOST} ^www\.example\.dev$
RewriteRule .* index.php [L,E=PROJECT_APP:front_end,E=PROJECT_ENV:Dev]
# #######################
# ####### Dev ##########
RewriteCond %{HTTP_HOST} ^admin\.example\.dev$
RewriteRule .* index.php [L,E=PROJECT_APP:back_end,E=PROJECT_ENV:Dev]
# #######################
----------------------------------------------------------------------------------------------------------------------------
This tells NanoPHP, that when accessing 'www.example.dev', load the 'front_end' project and use the environment 'Dev'
To access this project, a new rule will have to be added to your Apache Virtual Hosts (/etc/apache2):
----------------------------------------------------------------------------------------------------------------------------
<VirtualHost *:80>
ServerName example.dev
ServerAlias *.example.dev
DocumentRoot /var/www/servers/nanophp-v2
RewriteEngine On
</VirtualHost>
----------------------------------------------------------------------------------------------------------------------------
In it's most basic form, the Virtual Host Rule should look something like the above. (Remember to restart Apache - /etc/init.d/apache2 restart)
5.) Now generate your first project by running:
~> ./cli generate:NewProject
Type 'front_end'. This will create a project called 'front_end' in site/projects
6.) You can update your database models by running:
~> ./cli generate:DatabaseModels --environment=Dev --connection=default --database=nanophp
7.) Visit www.example.dev (you may need to add this to your hosts file) and you should see everything is ok and running.
8.) A basic version of the Admin panel will be available at admin.example.dev (username: [email protected], password: testing).