Your SlideShare is downloading. ×
Let's creating your own PHP (tejimaya version)
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Let's creating your own PHP (tejimaya version)


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Transcript

    • 1. Let’s Exciting on Your Own PHP! Kousuke Ebihara <>
    • 2. 4 OpenPNE 3.2 3.4 • (^o^) • • OpenPNE PHP • • (Ebinglish) •
    • 3. Go to our main topic...
    • 4. My “php -i”
    • 5. My “phpinfo()”
    • 6. Let’s Exciting on Your Own PHP Why do I want to get my own PHP ?
    • 7. What for? • Improving my work • Just for fun
    • 8. Use 5.3. And 5.2 • You should use PHP 5.3 for your developing, if you know about backward incompatible changes in the version • Some code for PHP 5.2 may not work under PHP 5.3 :( But the other way around if you are careful. • Use 5.2 when you worry about your script. (So must ready to use PHP 5.2!)
    • 9. But then ... • Do you know about the following script is not work under PHP 5.2? Why?
    • 10. Result
    • 11. Oh, it is just a bug!
    • 12. Fixed ... ?
    • 13. Trace changes • From 16 Jul 2009, PHP is hosted on SVN and there is a GitHub mirror! • So you can trace some changes in your git clone easy • Let’s tour through changes by using Git
    • 14. Fixed only in PHP 5.3?
    • 15. View changes
    • 16. In PHP 5.2 So dreadful...
    • 17. Talk about something else • I’ve written the following code by an oversight in template (But it is only worked in “short_open_tag=1” environment): <?= $var ?> • And I’ve written the following code too (But it is only worked in “short_open_tag=0” environment): <?xml version=”1.0” encoding=”utf-8”?> <?php if ($flag): ?> :
    • 18. A developer of Debian has the interesting patch • The patch makes the PHP 5.3 notify E_DEPRECATED error if the script uses short open tags (c.f. debian git repository) • If the feature had been in PHP, I wouldn’t have gotten the mentioned error.
    • 19. Unfortunately, the patch may be rejected ... • [PHP-DEV] Throwing an E_DEPRECATED for short_open_tag • But I really need it!
    • 20. So I want to get the following PHP 5.3 for improving my work • Notify errors to code that doesn’t work under the php 5.2.x • Notify to environment dependency code (e.g. short_open_tag)
    • 21. I thought of... • creating my own PHP!
    • 22. Let’s Exciting on Your Own PHP Build PHP
    • 23. Knowing the way to build PHP is important • You can build many variations of PHP by your needs • You can test your script under the specified version of PHP (e.g. array_unique() is breaked BC only in PHP 5.2.9)
    • 24. Prepare to build PHP • Here we get source code from Git repository for our customizing • • See and • Combinations of “autoconf”, “automake” and “libtool” is very important.You may get older version of them by your hand • If you want to compile Git or SVN version of PHP 5.2, you must prepare flex 2.5.4 • Some program may be not used if you using packaged PHP (because it contains pre-generated files) • If you want to use Git version of PHP, please get latest git and git-svn (I got errors by using git 1.6.5) • Of course, you must prepare some packages needed by extensions that you want to use
    • 25. Prepare configuring (only for SVN and Git version) • SVN and Git version of PHP don’t have something to configure • So you should execute “./buildconf” • Make sure that you use certain version of autoconf, automake and libtool. For example, I specified autoconf and autoheader to use (in Debian sid)
    • 26. Configure PHP • You can see the available configure options by executing “./configure --help” • Some options is for extension (enable-xxx, disable-xxx, with-xxx, without-xxx). So you don’t need to be afraid of options if you know about your needed extensions • Build PHP many times is normal
    • 27. My configure options • • ./configure --enable-mbstring --with-apxs2=/usr/bin/apxs2 --with-gd --with-mysql --with-pgsql --with-pdo-mysql=/usr --with-pdo-pgsql --with-pdo-sqlite --with-pear --with-jpeg-dir=/usr/lib --with-curl --with-zlib • If you want to use multiple php, you may want to add --with-config-file-path
    • 28. Make and Install • Do make • Do make test (I always pass it) • Do make install • Compiled php is in sapi/* .You can copy the binaries or intermediate files by your hand
    • 29. Let’s Exciting on Your Own PHP Customize PHP
    • 30. For my working Add original error level • I want to add “EE_COMPAT_52” and “EE_ENV_DEP” • EE_COMPAT_52 is for notifying “it may not be working under the php 5.2.x“ • EE_ENV_DEP is for notifying “it may be environment depended code” • EE_ is Ebi_Error
    • 31. For my working Add original error level • I referred adding E_DEPRECATED commit • $ git log --grep=”E_DEPRECATED” • I must rewrite: • Zend/zend_errors.h : define constants • Zend/zend.c : zend_error() • Zend/zend_constants.c : zend_register_standard_constants() • main/main.c : php_error_cb() • And notify the new error by zend_error() (in Zend Engine) and php_error_docref (in PHP)
    • 32. For my working Add original error level • Now, I have a patch for realizing this • Adding EE_COMPAT_52 and EE_ENV_DEP • 2fdd6fe27188ad3c5878b1fd3a8229e35f84d8fd • Notice to <? • e6706d2b9a576cd81991868d9a8522ba50c37593 • Notice to $list[‘’] = ‘’; • 1e9484ad04ca03b340bdd51d1f39acee32b86182
    • 33. For my working Add original error level
    • 34. For my working Add original error level
    • 35. For my working Add original error level • I want to add notices based on migration53.deprecated.php • Any idea?
    • 36. For my fun Insertion ;
    • 37. For my fun Insertion ; • ; • ECMA Script (Automatic Semicolon Insertion) • } •
    • 38. For my fun Keyword Arguments • RSS
    • 39. For my fun Keyword Arguments • Python
    • 40. Question?