Phalcon framework testing

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
luosteve@SteveMac [10:55:51] [~/tmp]
-> % git clone --depth=1 git://github.com/phalcon/cphalcon.git
Cloning into 'cphalcon'...
remote: Counting objects: 1437, done.
remote: Compressing objects: 100% (971/971), done.
remote: Total 1437 (delta 593), reused 799 (delta 352)
Receiving objects: 100% (1437/1437), 2.08 MiB | 792.00 KiB/s, done.
Resolving deltas: 100% (593/593), done.
Checking connectivity... done.
luosteve@SteveMac [10:56:01] [~/tmp]
-> % cd cphalcon/build
root@SteveMac [10:56:35] [~/tmp/cphalcon/build] [master]
-> # ./install
.
.
.
.
.
.
une=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden   -o phalcon.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/luosteve/tmp/cphalcon/build/64bits/modules  phalcon.lo
gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/phalcon.so -bundle  .libs/phalcon.o   -march=native -mtune=native
dsymutil .libs/phalcon.so || :
warning: no debug symbols in executable (-arch x86_64)
creating phalcon.la
(cd .libs && rm -f phalcon.la && ln -s ../phalcon.la phalcon.la)
/bin/sh /Users/luosteve/tmp/cphalcon/build/64bits/libtool --mode=install cp ./phalcon.la /Users/luosteve/tmp/cphalcon/build/64bits/modules
cp ./.libs/phalcon.so /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.so
cp ./.libs/phalcon.lai /Users/luosteve/tmp/cphalcon/build/64bits/modules/phalcon.la
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/luosteve/tmp/cphalcon/build/64bits/modules
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 
Build complete.
Don't forget to run 'make test'.
 
Installing shared extensions:     /Users/luosteve/.phpbrew/php/php-5.5.10/lib/php/extensions/no-debug-non-zts-20121212/
 
Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation
./install  27.78s user 3.81s system 99% cpu 31.690 total

add extension=phalcon.so in your php.ini and check it!

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
root@SteveMac [11:02:56] [~/.phpbrew/php/php-5.5.10/etc]
-> # php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
gd
hash
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
phalcon
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib
 
[Zend Modules]

Install phalcon-devtools.

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
root@SteveMac [11:30:39] [~]
-> # git clone https://github.com/phalcon/phalcon-devtools.git
Cloning into 'phalcon-devtools'...
remote: Reusing existing pack: 6893, done.
remote: Total 6893 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6893/6893), 2.76 MiB | 667.00 KiB/s, done.
Resolving deltas: 100% (2969/2969), done.
Checking connectivity... done.
git clone https://github.com/phalcon/phalcon-devtools.git  0.43s user 0.91s system 17% cpu 7.712 total
root@SteveMac [11:30:51] [~]
-> # cd phalcon-devtools
root@SteveMac [11:31:27] [~/phalcon-devtools] [master]
-> # ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
root@SteveMac [11:38:27] [~/phalcon-devtools] [master *]
-> # chmod ugo+x /usr/bin/phalcon
root@SteveMac [11:38:36] [~/phalcon-devtools] [master *]
-> # phalcon
 
Phalcon DevTools (1.3.1)
 
Available commands:
  commands (alias of: list, enumerate)
  controller (alias of: create-controller)
  model (alias of: create-model)
  all-models (alias of: create-all-models)
  project (alias of: create-project)
  scaffold
  migration
  webtools
 
root@SteveMac [11:38:40] [~/phalcon-devtools] [master *]
-> #

Using phalcon-devtools Create a project.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
luosteve@SteveMac [11:47:48] [~]
-> % phalcon  project phalcon-pj1
 
Phalcon DevTools (1.3.1)
 
 
  Success: Controller "index" was successfully created.
 
 
  Success: Project 'phalcon-pj1' was successfully created.
 
luosteve@SteveMac [11:47:58] [~]
-> % cd phalcon-pj1
luosteve@SteveMac [11:48:07] [~/phalcon-pj1]
-> % ll
total 8
drwxr-xr-x+ 7 luosteve  staff   238B  4 15 23:47 app
-rw-r--r--+ 1 luosteve  staff   123B  4 15 23:47 index.html
drwxr-xr-x+ 9 luosteve  staff   306B  4 15 23:47 public
luosteve@SteveMac [11:48:08] [~/phalcon-pj1]
-> %

Configuring Nginx for Phalcon.

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
server {
 
    listen   80;
    server_name phalcon-pj1.local;
 
    access_log  /tmp/phalcon-pj1_access.log;
    error_log   /tmp/phalcon-pj1_error.log;
 
    index index.php index.html index.htm;
    set $root_path '/Users/luosteve/phalcon-pj1/public';
    root $root_path;
 
    location / {
        try_files $uri $uri/ /index.php;
    }
 
    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9055;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
 
    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root $root_path;
    }
 
    location ~ /\.ht {
        deny all;
    }
}

Restring web servier nginx.
check it!.
螢幕快照 2014-04-16 0.01.10

How we start?
Phalcon is a web framework implemented as a C extension.it mean you can not directory to see khow it work,
there is no php file to view.

So we need something debug tools to wuick know detial.
Xdebug and Xhprof there are good one but Xdebug too slow to big.so i am recommend Xhprof is better.
After you install Xhprof and work with Phalcon it like.
螢幕快照 2014-04-16 13.22.14
And we can chekc the Xhprof result.
螢幕快照 2014-04-16 13.23.04
it very powerfully!!
And Important thing we also can see the Callgraph!!
phalcon_callgraph.php
Now we can see more and more!!

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *