Wednesday, 15 October 2008
Die interne Funktionsweise von PHP
Abstract
This paper looks into the internal workings of PHP, a programming language that is used to generate and control the output of a webserver. In order to understand the fundamental internal processes of PHP and their causes, the structure of the Internet with focus on the Web is herein described. With this knowledge it is possible to easily understand the roles of PHP's components.
The execution flow of PHP is dissected alongside the layout of its source code repository and a couple of key functions and their roles. Syntactic analysis of the PHP script at runtime is pertinent to an understanding of the system and thus the importance of grammar is also adressed. Since PHP is very complex and a complete study would go beyond the scope of this paper, methods of independent analysis are also presented.
The execution flow of PHP is dissected in parallel with the layout of the PHP source code repository and a couple of key functions and their roles, are presented. Syntactic analysis of the PHP script at runtime is pertinent to an understanding of the system as a whole and thus the importance of grammar is also adressed.
Lastly, it is shown with an extension how the PHP-runtime can be enhanced.
Zusammmenfassung
Diese Arbeit setzt sich mit der internen Funktionsweise von PHP auseinander, eine Programmiersprache die zur Generierung bzw. Steuerung der Ausgabe eines Webservers eingesetzt wird. Um grundlegende PHP-interne Vorgänge und ihre Ursachen zu verstehen wird zuerst der Aufbau des Internets mit Schwerpunkt auf das Web nähergebracht. Mit diesem Wissen können die Rollen der Komponenten, aus denen PHP besteht, leichter verstanden werden.
Der Ausführungsfluss von PHP wird zeitgleich mit der Auslegung des PHP-Quelldepots untersucht und ein paar Schlüsselfunktionen und deren Rollen kennengelernt. Eine besondere Funktion zur Laufzeit spielt die Syntaxanalyse des PHP-Skriptums, und deshalb wird auch auf die Bedeutung der Grammatiken eingegangen. Da PHP sehr komplex ist und eine vollständige Untersuchung die Rahmen dieser Arbeit sprengen würde, werden Methoden zur selbstständigen Analyse des PHP präsentiert.
Schließlich wird anhand einer praktischen Erweiterung gezeigt, wie die Laufzeitumgebung von PHP weiterentwickelt werden kann.
Download it here.
Sorry, it's in German only. Aber du kannst gerne bei der Übersetzung helfen, sodass viele andere Programmierer rund um den Globus davon profitieren können :-)
Tuesday, 14 October 2008
How to Create a Math Calculator in C, the right Way
Here is a small PoC on how to build a calculator with a lexer (re2c) and a parser generator (lemon) in C. It supports the four basic mathematical operations and parentheses.
Thanks to MacVicar for his help.
I'm not sure if it works on other platforms beside Linux, as that's all I have (not!), but hey, feel free to improve it! :-)
calc-0.1
Thanks to MacVicar for his help.
I'm not sure if it works on other platforms beside Linux, as that's all I have (not!), but hey, feel free to improve it! :-)
calc-0.1
Labels:
c/c++,
linux,
poc,
the right way
Thursday, 9 October 2008
How to set PHP on a development box, the right way
PHP is not set by default for a development machine, but for public servers. This is a list of settings I recommend you to put in php.ini on your development box:
Hint: you don't have to look manually for every configuration directive, use your ascii text editor's "find" option, which can usually be achieved by pressing CTRL+F in the editor.
error_reporting = E_ALL|E_STRICTYou may also want to test your scripts with
display_errors = On
short_open_tag = Off
asp_tags = Off
display_startup_errors = On
magic_quotes_gpc = Off
output_buffering = Off
allow_call_time_pass_reference = Off
zlib.output_compression = Off
track_errors = On
register_globals = Off
date.timezone should be set according to your time zone. A list of timezones can be found at http://us3.php.net/timezones
session.auto_start = 0
tidy.clean_output = Off
implicit_flush = Off
log_errors = On
ignore_repeated_errors = On
report_memleaks = On
safe_mode = OnDo not forget to restart the http daemon after saving your changes to php.ini.
Hint: you don't have to look manually for every configuration directive, use your ascii text editor's "find" option, which can usually be achieved by pressing CTRL+F in the editor.
Labels:
php,
setting up,
the right way
My First Post
Toată lumea face în zilele noastre jurnalism de maidan (nu că cel "profesional" ar fi mai bun), deci am decis să încerc şi eu.
Nu ştiu cât timp îi voi dedica, dar aici intenţionez să postez sfaturi de programare, tips and tricks, probleme de care m-am lovit şi soluţiile lor, gânduri despre ce ne înconjoară, ş.a.m.d.
PS: nu, nu "personal blog", şi nici "m-am trezit, am mancat, m-am îmbrăcat ..." ;)
Nu ştiu cât timp îi voi dedica, dar aici intenţionez să postez sfaturi de programare, tips and tricks, probleme de care m-am lovit şi soluţiile lor, gânduri despre ce ne înconjoară, ş.a.m.d.
PS: nu, nu "personal blog", şi nici "m-am trezit, am mancat, m-am îmbrăcat ..." ;)
Subscribe to:
Posts (Atom)