From ca9627e70852f6b2e835660df870fe3ab405882d Mon Sep 17 00:00:00 2001
From: "Suren A. Chilingaryan" <csa@suren.me>
Date: Sun, 1 Sep 2019 00:00:32 +0200
Subject: Initial import

---
 dev-lang/php/Manifest                              |  41 ++
 dev-lang/php/files/20php4-envd                     |   2 +
 dev-lang/php/files/20php5-envd                     |   2 +
 dev-lang/php/files/70_mod_php.conf-apache2         |  17 +
 dev-lang/php/files/70_mod_php5.conf-apache2-r1     |  17 +
 .../php/files/70_mod_php5_concurr.conf-apache2-r1  |  17 +
 dev-lang/php/files/70_mod_php_concurr.conf-apache2 |  14 +
 dev-lang/php/files/eblits/common-v1.eblit          |   9 +
 dev-lang/php/files/eblits/common-v2.eblit          |   9 +
 dev-lang/php/files/eblits/pkg_postinst-v1.eblit    |  76 ++
 dev-lang/php/files/eblits/pkg_postinst-v2.eblit    |  64 ++
 dev-lang/php/files/eblits/pkg_setup-v1.eblit       |  28 +
 dev-lang/php/files/eblits/pkg_setup-v2.eblit       |  16 +
 dev-lang/php/files/eblits/pkg_setup-v3.eblit       |   9 +
 dev-lang/php/files/eblits/src_compile-v1.eblit     |  60 ++
 dev-lang/php/files/eblits/src_compile-v2.eblit     |  17 +
 dev-lang/php/files/eblits/src_configure-v1.eblit   | 280 ++++++++
 dev-lang/php/files/eblits/src_configure-v2.eblit   | 276 +++++++
 dev-lang/php/files/eblits/src_configure-v52.eblit  | 279 ++++++++
 dev-lang/php/files/eblits/src_configure-v521.eblit | 273 +++++++
 dev-lang/php/files/eblits/src_configure-v53.eblit  | 262 +++++++
 dev-lang/php/files/eblits/src_configure-v54.eblit  | 260 +++++++
 dev-lang/php/files/eblits/src_install-v1.eblit     | 160 +++++
 dev-lang/php/files/eblits/src_install-v2.eblit     | 165 +++++
 dev-lang/php/files/eblits/src_install-v3.eblit     | 160 +++++
 dev-lang/php/files/eblits/src_prepare-v1.eblit     |  70 ++
 dev-lang/php/files/eblits/src_prepare-v2.eblit     |  71 ++
 dev-lang/php/files/eblits/src_prepare-v3.eblit     |  73 ++
 dev-lang/php/files/eblits/src_prepare-v4.eblit     |  62 ++
 dev-lang/php/files/eblits/src_test-v1.eblit        |  54 ++
 dev-lang/php/files/php-fpm-r4.init                 |  47 ++
 dev-lang/php/files/php-fpm.conf                    | 310 ++++++++
 dev-lang/php/files/php-fpm.init                    |  22 +
 dev-lang/php/files/php-fpm_at-simple.service       |  13 +
 dev-lang/php/files/php-fpm_at.service              |  14 +
 dev-lang/php/files/php4-ldvs                       |   1 +
 dev-lang/php/files/php5-ldvs                       |   1 +
 dev-lang/php/files/php529-ds-odbc64.patch          |  16 +
 dev-lang/php/files/php532-ds-odbc_timeout.patch    |  43 ++
 dev-lang/php/files/php547-ds-odbc_blob.patch       |  19 +
 dev-lang/php/php-5.5.17-r1.ebuild                  | 790 +++++++++++++++++++++
 41 files changed, 4119 insertions(+)
 create mode 100644 dev-lang/php/Manifest
 create mode 100644 dev-lang/php/files/20php4-envd
 create mode 100644 dev-lang/php/files/20php5-envd
 create mode 100644 dev-lang/php/files/70_mod_php.conf-apache2
 create mode 100644 dev-lang/php/files/70_mod_php5.conf-apache2-r1
 create mode 100644 dev-lang/php/files/70_mod_php5_concurr.conf-apache2-r1
 create mode 100644 dev-lang/php/files/70_mod_php_concurr.conf-apache2
 create mode 100644 dev-lang/php/files/eblits/common-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/common-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/pkg_postinst-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/pkg_postinst-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/pkg_setup-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/pkg_setup-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/pkg_setup-v3.eblit
 create mode 100644 dev-lang/php/files/eblits/src_compile-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/src_compile-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v52.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v521.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v53.eblit
 create mode 100644 dev-lang/php/files/eblits/src_configure-v54.eblit
 create mode 100644 dev-lang/php/files/eblits/src_install-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/src_install-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/src_install-v3.eblit
 create mode 100644 dev-lang/php/files/eblits/src_prepare-v1.eblit
 create mode 100644 dev-lang/php/files/eblits/src_prepare-v2.eblit
 create mode 100644 dev-lang/php/files/eblits/src_prepare-v3.eblit
 create mode 100644 dev-lang/php/files/eblits/src_prepare-v4.eblit
 create mode 100644 dev-lang/php/files/eblits/src_test-v1.eblit
 create mode 100755 dev-lang/php/files/php-fpm-r4.init
 create mode 100644 dev-lang/php/files/php-fpm.conf
 create mode 100755 dev-lang/php/files/php-fpm.init
 create mode 100644 dev-lang/php/files/php-fpm_at-simple.service
 create mode 100644 dev-lang/php/files/php-fpm_at.service
 create mode 100644 dev-lang/php/files/php4-ldvs
 create mode 100644 dev-lang/php/files/php5-ldvs
 create mode 100644 dev-lang/php/files/php529-ds-odbc64.patch
 create mode 100644 dev-lang/php/files/php532-ds-odbc_timeout.patch
 create mode 100644 dev-lang/php/files/php547-ds-odbc_blob.patch
 create mode 100644 dev-lang/php/php-5.5.17-r1.ebuild

(limited to 'dev-lang/php')

diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
new file mode 100644
index 0000000..d075da6
--- /dev/null
+++ b/dev-lang/php/Manifest
@@ -0,0 +1,41 @@
+AUX 20php4-envd 145 SHA256 17cd1a952434988b4c2125e4d1eef1df7114809f404605d35f255674419dd5d5 SHA512 1bd22935b6b452845fd42c0033eb336ca61556b3375c8fc4cc253e94e50ef1e7c7a40a47a566138da1784f9e4157378c9f3479439d659986a05aa236c1494bb5 WHIRLPOOL 445286fe180fef2193975beab9a51e3005637588e43a1a728a5b1c0a7bbed8edcb48a8ea0c5faf4fc664c15daa927bda7a0769a8ef0d962236f05c540d57e648
+AUX 20php5-envd 145 SHA256 efaae9e6ae5f7010e073c2ab6d8a9dda009f0707c7d7b0c027e142c94f7041a4 SHA512 581aa86479e3cd584ee1bc6dc6d4a135fe8ec343fe5519566d728d81f7018cfb23658bd0c0368951d380982c75adbb4f45acf3c146868aaf4e4ec8e9f2fad1ce WHIRLPOOL b9cfe0e80ba437bbc6008223c268bdafcde306ba8083dce96815804f3e1ec0937706e0db091149785a0076a6c6eaab8f7dff28578b706e84b4bb4e67850a4ecd
+AUX 70_mod_php.conf-apache2 454 SHA256 dd7116f3439e06ef2d6126403360c2722355f8481552fdce0cb601af331f81ee SHA512 179c0d96a1422c9f5f4939fa1f39847fa6175abf698146c9288f28143f7f0c9f24f5e4eb166b787dceb7381b07b7bd9343ad76c18667d221479caa7f18a61d46 WHIRLPOOL dff3fa7a80644f04e16bdc4be46b4db355ee5dc28e512c7748c1c6c761d34ef5a77242bdeb89710de037efc8dafa397ce28dd4c5df8ae159966dfe3b9ced2813
+AUX 70_mod_php5.conf-apache2-r1 374 SHA256 815c1ca23c9afe8479568ceaac4057eb91ea5444fbd863866b29adb4eea2c82b SHA512 a97bcd6a37ba85752b8929b597f7cb75aa69ccbe6cf1f353db167a8b23d66b8a0044d3969dea0368a2b32a6f486dccd60b9cae9d4391da2e5d7fe4dcf21c79c7 WHIRLPOOL 3bf5fdc7a2ea483116468be579ff40b92134264f69011d49c2f9ab4c88845024579920bd865d8bb5f2e834bb3da9674fcadadcbf22381cf0d10dd81a99d9fcb2
+AUX 70_mod_php5_concurr.conf-apache2-r1 376 SHA256 c05f499d9c8927391c586b94716a9f59d63767165552ea527ec7ff63c36eaa40 SHA512 06eb12012b8062116355f0da18ab1bc8abc4e20b534a8b5e10c325b2af4ef0a2d30c4c942f38eb628a123d94c87d2e995c97cb91bf4772fe8a8d5533d9ff9669 WHIRLPOOL 8e7c524b466f6f31031d291f0d5f945be79ad6f4015b482e66541f6bd05c26ede59a1b471fe457b950e1fa87d53aaeb8b05a2ab89a11fff73c6f152c721878aa
+AUX 70_mod_php_concurr.conf-apache2 329 SHA256 092178aa0cf3272b6411abc85b3820665322598932d249c284a8fa4108d5835a SHA512 8e960015802daa0e42e47962e4f3925a705c9bacfd7ac3387973a9c5d7c1ba86dc4a22e0928dbc586cacb59129e298939aec0af7a59600092b4cc741b4cdeb88 WHIRLPOOL 9c9cd9a634882071578489085954695548e7c5d506fc4f8ffc9cb07d3652c62129fe8673271480e9cb136979cf300b7765e8485838edafebd3d26a73bd48fc11
+AUX eblits/common-v1.eblit 379 SHA256 65c909a6d0501a6746518f539c4a4021426469cbf20b2a212fb0d60b48da5362 SHA512 c85127d09b64a1b2c39057aa5b0397468ce6566f2d2fb604cb68796431979eafaf125f23cb1dd64397f6e55faa565ce96f75a013cd70fcf2a9cf65aa8297c01e WHIRLPOOL 8b195a7ad59af474ea2765cb2a3867927e76eade827a3daca155773ef8cda3b48753e4520a90a9a90f75223df8c631b584ba16fc21c551b1c7b29d53992a4846
+AUX eblits/common-v2.eblit 379 SHA256 8c15442b04b0216342ef6f2b8565cb3510f6850fe67745d5697861e2f7759194 SHA512 2da1176a288f509f8920c6f3d690fb71ce73ebf7651f6404f678b4567227c930e7965259a026ccdded20acbe3ee03be596fd6253da51d132f6b0ea0165963e55 WHIRLPOOL 1a4cd516d27034a99a4f4aff4334961556faa2c3f014070403faf27999060db4faae1fa7160ca94ab0465f9fc85b4b5eb9e2eb5e1880343e30daa0d3ff28fdae
+AUX eblits/pkg_postinst-v1.eblit 2406 SHA256 2cad6bf864ea0ad9464642ad9f0fa0e90262771edb2a588cd48ef54d7848e729 SHA512 a3536554b9d3ddf7a1b8402cb7d85990f2c5550b19afa7ec85a05a9a9a5f8ae5443e14e54fb87d2210c5f8378a2d9f4d1ac158ea7aea563e033a3fb5591438f7 WHIRLPOOL 857f95ea481177b67f7ac2917d2d82e27571733a5a22f9d64a5f0d50fe65c586158957d89f65b89baccf56da7db2110daada55d86bd783d252f14c6343bf1eea
+AUX eblits/pkg_postinst-v2.eblit 2371 SHA256 8ea78698a2e6f2e6525bf869c6a085cd37761d8c8429f9d1f0cdeee7986756ee SHA512 6e9b6f03ae37728914a0e45470818ad50d428999a6f186b043a893d9ba2c0e311d3b0f0fa2a130991353fdd93cfcd346827923dc9117c506c29acd608af7d974 WHIRLPOOL 41c5012c24b08917ea115e8ed1d93d21097b20eb8a5558cb22bc1b8b8d30135d12e2f9ce3129d848671a893fb2220ba2b8afe548cbfbaade1a19d15495284d66
+AUX eblits/pkg_setup-v1.eblit 777 SHA256 2613f51ee9e3a258dbab38ff2df724f2971a50a5ad8c097cb5a4e3744df5fc8a SHA512 fd507d33006415795368a5b399341a93f10b611fe92a5ef89eb1748e4cfb772617d6d4f8e02f7fce7a021abf1829f6b72ea9928e681cedfab1010bbdc3a33070 WHIRLPOOL 5ddb6d392ca758adb72d4a8c70940e42743c1af21ea95b163ebd24132cf772828b2b58d687503aa74e4fd9a9319b29f912c7d811157d55c3b16fe75773237447
+AUX eblits/pkg_setup-v2.eblit 393 SHA256 17f9316065960ff0ca56aeec918c2c9e6c80ffdf951a238f7271a589753e320c SHA512 b5714b40c99d6e2eda73cb42cac888ea97680df1ea1c8c430a978c34460a0099f3c9b3438a59bef14acef4ab6653122fdaf10e11bafca8225a87e7ea6f61f416 WHIRLPOOL cbc7d50da571141d28859af2e252b77c79e40fb8a6605019e0a34aa8bf6fc100aa8a61ff2855c9e453ee3d837e8965e68873eec248f2941e4ed2e6c2803a166a
+AUX eblits/pkg_setup-v3.eblit 283 SHA256 5905eb3e6d984a9f8fe49e088adad99db7249f62a957c19f0ae4bf3f56ecaecd SHA512 e1c7fc1bb0a59021767a7bf848de88b0cea602ad596f40768b3b98e90713d41abfc690a15578eaf575ce3841bc52069d229b5470b3e5cd78cb962007b6da8eee WHIRLPOOL a91534151f0dbd804a4af634ca9c29e3008759664a307cd5338d518d4bbc0790bc473f71e645543682e7c25953e524b224d14e9463a2cbbbbde56d3f43e81d77
+AUX eblits/src_compile-v1.eblit 1283 SHA256 5ec76ae24304c5f803a615a98394c219018da1b1ce2018f92f6ac8c5becf6c99 SHA512 2ff139344b874de9f032248687fa51a75d5df5eacb5ff6e879c26391624fbd6c4744034a34b0109bab3e434fd6f189c0dea4e298818ebf2c0c94973cdbf721d0 WHIRLPOOL 2971e61a6932a7c2c19bb40b26f67d529560d08116c37d7b645dc008710d7cc8cd75dcc8feca95eeb556687910968dbe90b20554ad0ca97a624cd7f9c9221482
+AUX eblits/src_compile-v2.eblit 515 SHA256 60fe1529591f7531ad4af37fab1a52e2ffe197f27a19f269b3b62fdbc044261c SHA512 84a041897b9468e22e61914b4134bc26aabc11a4ccc2d782151c03b17acedc6e6a31e61d73f660135d4dc7b96928b239f21248a4b7ec3689eef59c5f31ea1fa1 WHIRLPOOL c0d77ff4d8381878b563210f56607fefd14bea85ce715f9abe74e7e481342efe962e8e025d33e83f89ffd08a5b39e4b6cc0eecd441a9a0ced2a27098c12f64b3
+AUX eblits/src_configure-v1.eblit 10979 SHA256 dc769b7c5846248fdd5d1a930a3e9b614d550bfcc78f09ecd1c08607796f0206 SHA512 ed170b561266e8b23444d7fcd9e4188344cce35120b5921310d3847f0e9e3292b6f4fde91430a5eb303467dc6db3bd746f8f228b3ae6d8ff0d4f5c5dd7a71964 WHIRLPOOL f9421269cf8b47813fd6ad24b1c30ab98213bd39e047d692f42d12fbd727bfaba0082dc438655726765971942b0025318d44a60e5b662bd4e61efceeff009e8a
+AUX eblits/src_configure-v2.eblit 10855 SHA256 cd3002b6c9bd91dc9d7471e416cc631247fb2ad9d7b68981b26a3f83f84c916a SHA512 a91d4a34d5ea56196715c908dfca39f54c100761dfddad3a4c87014cc58da013e5b2327fd7eed46e36913336d21f393289cfbe59ad4bb1abeb592b562a8c43af WHIRLPOOL 2666978310e910f98325ea54e8e61bb980526e216d3a84135cf71c89acd676020e3cea6c7e69dc2dab03804ae67e0270ea2835dc1bcfde7a03ca95e80f1923d8
+AUX eblits/src_configure-v52.eblit 11017 SHA256 784ec5482362cc8f0725ca30a186e08958d7e8e752a238af043cfa8c7a68ed85 SHA512 07de91cc25457da1c257e093d4f58ea2e746c4ee63db34e12564b2129ea4d95ee381db5553108e3aaa02b951345abfac434288646e8b67ad904638fb32d85b06 WHIRLPOOL a4197d90f1ef1a559ac554edde4d8957dae00241528ff1147cfb310dfbfe2e1319259453c698297b28a2b7cfdf8b8b8a048554007d415cf37e1f68c2e15a9fe5
+AUX eblits/src_configure-v521.eblit 10844 SHA256 ad875ca45e9ad975c0d7a3cbedc27c5035aa048d7aa935221a15e47cbca63c3d SHA512 eab9ac435d179b5452d00062977f7e6b858a98a40942f1edb4c063753a003f4dd61c126d84f4d490fa9a1a321d41ef3fd852d81673bfa0da03604338e3d7b87e WHIRLPOOL 80e4f15c6dcee14634e52d454ee8d359d37eca711f19ae9f0d7c2534ddf8c45d406a1928a855fb92d0af3caed7f5f2986fc76fb40480debaa4788a64098a1a53
+AUX eblits/src_configure-v53.eblit 6718 SHA256 a8f8ce539087ea53bd2f4a5e9443017c45a676870cc0a3f2bfba2b1af49f546a SHA512 9bc5c1d94352559cd9e7e10affa0dcbbe0a865852b5f0df9789fa8237e59f8030dc260ace7c5688c9dc1075eb6e10a63e67d030f0a002ec5c0356c61539ec7aa WHIRLPOOL 0b1bc663a9918eb240075b9a8b3f5d851055b4f3bcb85c9aef7b3fe4b65d6cfe36bd9bcec0f21f095d84c1b9e7606a0485bf9c7cb524dfb2a348f2470b5bb797
+AUX eblits/src_configure-v54.eblit 6617 SHA256 1ba1e6a51417e8ed967fd036be1919845b821b8fc0ba3b69b2895d7db013162a SHA512 1016b66dbdd2e5985cc82e5a0a01e85f0b5723437044ba9239868a15e2b7fd97b5efb34d025c196747592bbe293417f7c630d1ae973d076ddac4808d9699cb6e WHIRLPOOL d7756df054bbcfdf1741f09daf125484bf9114c9c70e4e74baef338228ef5fae3af921111e2175250fc1eefea9746871cc16a1e4f18a7982a0337e0b913f1ead
+AUX eblits/src_install-v1.eblit 5146 SHA256 3bddd375764b0ed00cb30e65036c67f96c56ea0ebfd70bcdc61b7465d1500d36 SHA512 37d9d322eb4f4cdc6259f77789923d7d9a343047723d4ba9fde6566cfd291f77a0acaaff292158966059f6d5506e47a89a5fb5913e3240cb7d11dac9956c12d6 WHIRLPOOL f696f53e667fed56cbfa273c03c9eeded6ef50984a91d27bd932e5751e57b4396b85fad75593b529d9fb2f463cc8073bacc750bd469e7703da6795e71b989a58
+AUX eblits/src_install-v2.eblit 5237 SHA256 860bf8ada8a4900d6a4bdd29bab3e65aff29ba8ddbbba4bec50d9d29c6990ca4 SHA512 e8efa688e9f8418a46fb3ef734d787478c77a7cfe2a0e65d9eeaf70241e29964e494c761dcbf61c0e32642ef113b296c66e27e8891b4617ddb2448834b0daffd WHIRLPOOL 100fe0d603ae2105ad5897390c774d93b015f81651369d94ea187aa7e2d37dbbe0a64094dd66e7aad2de0ff7f869c1481c688bde9a8156bb659141ae1681f073
+AUX eblits/src_install-v3.eblit 4744 SHA256 a1666bd7ce923ae8a4a4ae6812bb7ff8dab66ca0d00717fa45c17397cc03f25c SHA512 675d7ec00ba13b1a76ccfabda925ad4a63a6fecf9078770c43da2f5654c8a48df10908adcad00f04432c873262875602bc7d22ddbbb5dbed261ce301798c16c7 WHIRLPOOL 9f1646bc2f8853937ba9a9fc687827dfa4616fe3d02da35c38a2e909f0f6a1975e7ce5ba0334566ae668a95dfffd02c83efe916ea138b37adda0f087311ee771
+AUX eblits/src_prepare-v1.eblit 2616 SHA256 915b9755a37f7670f6e436fe5072dae8f5e6b437ccdfbff835e26bb2f9d22b1e SHA512 e56a34c703c993710369495f7300f09e169dab761718b800f3790f1dafe147c3dcf4311a6eae7c91aa6a5fc40314dea560a383e1505676a7e175b7c8339a6fea WHIRLPOOL efe971058bf9532409bf8273187dcfe4acbbc362afc06922ba3666a3052595907eee6d8fcdc8038d0ed9619bfc0771ce9616622b782465e7d3d391e1e8795102
+AUX eblits/src_prepare-v2.eblit 2604 SHA256 fe7534260fb81a012b8021b5d555756ce8733ad192bf51cedd94f12963811790 SHA512 02b7132e78d41829832c3d0c7e8c47a3ed8747074f5092c2f649c93c31ba84e3ecb7ada259986182077251886449622aebdedfd301cf80a11c1cf47603cea4f4 WHIRLPOOL ad420b8c11e3093b24a4fac793170fba401e0fea293970aa6803c8ce13a1c4aaddc54b14def5ea42885a261aa3658eac44b08313dab8042bd5bba1fb441742e4
+AUX eblits/src_prepare-v3.eblit 2649 SHA256 7ea3a5351fabeb050161e64c09b98ff945bbdb8b4d1a7fb83d6b4645f277b486 SHA512 0c1c5caf47e5955116ddec5b87022920a37f079211aaefb25c9a14b0c269343e808593b4727ea7e3d07487ed0a74de0e683ded318200c304943149548a75c34b WHIRLPOOL 055c5bf47e2c02537e24421cc796316b8a390a0d5447149eda5398b9708e05bfd71167e5ea2fe959432a6abb508f84d7f7cbc84748048c87e7777468bb6ab78e
+AUX eblits/src_prepare-v4.eblit 2317 SHA256 7c18252a49a6d8e071471d14624f284d7b3ad8b95cad4a001e10e6e521f4c9b1 SHA512 e5c8200cd393266f9e608ebe680e74d539f897ab288303ba4b09963c09c3fdcdcd850443c7e76b0f9343f977fec148f448391e94ffb0e81fe46c69e7e9d7bca6 WHIRLPOOL 0246d02c8e1856acbae723ed53f8286921fed7b671ecf2fd7c712d7345ca6dcebfe79e09e83c77df06e4fa6dff0f3e25c92027f2bc9bed2c2b69018cbbcac987
+AUX eblits/src_test-v1.eblit 1530 SHA256 67501925cfdaf9043e4985d0f1c797e62fb42bf47e6863b5ffdecb104888e82c SHA512 41c599ba577bc48bd4300592b5d515718cbf498165c601b87d7aaa098e045c56853c1c73932530262181b76c8cb854ceb252e947b35e8d619204e18680bed246 WHIRLPOOL d7439cfd95fff55ee7d91b3001e700dbd2dceae1dcbea7750e3df434c0f020860aa0555f383487dc0fc5fa7c16ac9769c58130be43fb9dd44286b6c7294b6698
+AUX php-fpm-r4.init 1157 SHA256 37e34461babfb5881169f9729fbdde7d4aba533f123e2c480fe25ac3b863d3e7 SHA512 3555a2210104185b93b3805400995ed987076429c47b0950f58396c535d7ea99a5d2e7eedde071e2de06f4e248e0cb9bd27ccbf01b5606152a2f559fe874afbe WHIRLPOOL 6f5f0e45004275c7c984e68c293282db23461a64965b7d7c4a0ded682140177989ed50217aea6253178cc18fa9f9d202a69383400dc1a53271f00e85884849a1
+AUX php-fpm.conf 12898 SHA256 8ebd676e058e5b64fbb8b5ed0be693e4da8f6fcedd5e427757afccc13504c48d SHA512 cfd93a8381f4a60a71bcf1bedae4889280eafcf92ba7a0f93ea164cdc87a29f598d80b9b98867d8cb966ef5e42f89a291959a84b592433b458cb7e364cec0e7d WHIRLPOOL 3fd4ce204895af20392e28381ab099344756c7a4ba5910b7e3f5c1d8c80bf96cf17eabdda3a801dc07ec8ebc8ead07833c0d7313419d7552e1f661dd2a8fc8bd
+AUX php-fpm.init 385 SHA256 baba8dab2cadc8bdf107e6fe5cede2f5faaabff1281781a0a30b3be79964c94e SHA512 a60fef565ca122c3b551564f493f1cca96d1fd6cef2bff455eaec2162482da88d92cb3fbbb2da64a5bb2aa6c2d291761c888a6bac561c52fda05632dbdeea3dd WHIRLPOOL ac721e59817045fd1a0bbab84b2c42fc2d11f7b66a3ec0c3d937c38177038a2b998fa9ae50daac705acf89f01b7b1cfd9dca6148361a9c8938d6078e739363df
+AUX php-fpm_at-simple.service 316 SHA256 c11d3bb213993ad27642abf2fb13ab8d9bd3fd8ffb6c863ca0baa057555a2fa6 SHA512 7367a3f8d3874f8e0c76f331ba613a0250db02f60ad9f87affaf448dcb5bc34bcecb91d88f415764a12b24b46ae3d1b738a002af9f77a4b707e916e83a0021fd WHIRLPOOL bf78a0e1bc22525de1bfa6896ceeb39932f4a1507820667f5216af10f8de205436a82abefe55d4776d911de99070e6f6ed3dacc1708288323d8ad789dab57fb9
+AUX php-fpm_at.service 317 SHA256 6bbbbd7b6501305c17b7290bb2a83b0ebe492d421adaac8f394e387ed52e0d25 SHA512 27982f9e2d958bfa75c89c7d3531e48d17fc388b1cdcbc8e09051b236b1184ee2baabdfcc567c19d9fcd067d4b3b86f171015616d8da42fccdabd89432d865e8 WHIRLPOOL c101ad8eb7446a6fcb3dba6ec6caae12bd6c0a9d251e222c392abb37314fbc252321bdc7db1696480050ce543a154b7257e503d3065d9e238d1c5c76a74d65ff
+AUX php4-ldvs 22 SHA256 4aee18478b09cda7e925ccde157db6099ea0122b5c4efb0868e3761b65688dde SHA512 a48eb3efe6802b6df65a929310945e4f7b0e53e69c4d9539e6656b4d525681559d70a201903daa32933403c24b7b524ef6639f21d8c8429659966c5ed88cea47 WHIRLPOOL df202f6096fb799920111c73610cc7a1ce5745f0997cf35177a70a709b4c331ece0f0b5fe0adc9cdadece85ea2f8b65d910b5ddc54fda4f81b97e505bc08464a
+AUX php5-ldvs 22 SHA256 b79d0e52b1b3b4543b31ad45525ae1c2814a27ea8e676772ab10bf6fb12dfe79 SHA512 689a0a12b3527741d2e47870c125e93be73a127e5e798c4b685ccb11653be5a8615faf3178c71a6346fe264d3c4ec76601bc05878fef67b9dbd2e45be59a344d WHIRLPOOL b24f193a1067f699c8efb199ba4e3f1fdd22c13dff98655206b30072ce8c8035fb4ed9288f694856f9978bd9935d3a5589cd968316920e712779c45b44897634
+AUX php529-ds-odbc64.patch 502 SHA256 6669b32122d8a832ac2538ed27c09a0d7dcad63552e3a68bc5f2ad0638813d86 SHA512 547acc044fce909fe76472cd0c81991ee6be6be1e51f41e50e8192f2306b9f5a5e32d3d7fb129051149c012bfc0f8c1aab54c471c00a536f9511242e2d2a139f WHIRLPOOL db1948f3df12ec2ca4e39e5e70af718137396ce7e64235ed8111c2df3e7214fc3475e161b300d41edc22865228a67376a66fb2d5571e330b9824eac665b0b0af
+AUX php532-ds-odbc_timeout.patch 1583 SHA256 cc1d89125e7ab574e48b4e37f0ecf7b536d44b347184bdb9c87eb251dc554ea8 SHA512 c237e5bc37c556e2bebe57f6f2e93a3fa5b1e35582dc3746bb74a654fb7491dfedb404e72b44413c78237adc0db6ca8567c9022c21c9bf44881eefdb061b60b1 WHIRLPOOL d77a45916c1a254388deac500c8474afd05c82d002335b7fbc92dd029bee691ac1287375666b6ebeb613736dce65b8db71a3d82cca7c4d7787fa8768b3ebb163
+AUX php547-ds-odbc_blob.patch 632 SHA256 bc3a715d41f93639c7d85ad38f6aba80884a0e57027cb00c06e44df324f88608 SHA512 7fff693338f4bb090c0aa1dc2fb70695f1380779e3dc8226001fc2893041fee74bc56d71e797c56057f21d093aa50c3cb347ada31e9fb491365ea28f7999aeca WHIRLPOOL ffefd684a694e842e3270e171d12777371699b18f5ff97f3a943118a56c80ba6b387d3d06950a66ff91403e78c3c34796420d837b7c6144a143531ea440f6667
+DIST php-5.5.17.tar.bz2 13269227 SHA256 5d81db0c8b2a68da05715c363d037922b82a45c966785d64a77482e5c01e4e1b SHA512 898ab5ae1bcd7def149d63c919cbffa2d9708052a230465d39e53b46d39ec124f52ba31e6440f0ad96ec1e6e4fe4dec3e52bcb4f9a2e7d0af7cdcc94e81e493b WHIRLPOOL b606bb596cfffcc9f3ded6b0c2e2bc18ac5412713beb2a357ae6e93886a8a20119749b33a41cc8fb8d3f9e74b9585b1f66f71d16e4ebe781afc8ded7f9f4bf23
+EBUILD php-5.5.17-r1.ebuild 22508 SHA256 e158406aa88e154785ec79f0e168fb4121219c5be1c946c97c34723f853a2339 SHA512 5d52e3e720027af33771eb06b725bae81f656110233b24de65f184310e22efb3c0034dcb0b1e8ba56bdff5498a2e2c88a31c41074709aa463a95fe263bfa2b7c WHIRLPOOL 1e608079a4b830038e0ac7a3417ed29e81dd089172bdbda22dc873ad6498b3731bd3f38bca01d1ab3b37eb7d24513bf6d3c56f84e564220a1a03f1e3aaed391a
diff --git a/dev-lang/php/files/20php4-envd b/dev-lang/php/files/20php4-envd
new file mode 100644
index 0000000..ac444e9
--- /dev/null
+++ b/dev-lang/php/files/20php4-envd
@@ -0,0 +1,2 @@
+MANPATH="/usr/lib/php4/man/"
+CONFIG_PROTECT_MASK="/etc/php/cli-php4/ext-active/ /etc/php/cgi-php4/ext-active/ /etc/php/apache2-php4/ext-active/"
diff --git a/dev-lang/php/files/20php5-envd b/dev-lang/php/files/20php5-envd
new file mode 100644
index 0000000..f6033ae
--- /dev/null
+++ b/dev-lang/php/files/20php5-envd
@@ -0,0 +1,2 @@
+MANPATH="/usr/lib/php5/man/"
+CONFIG_PROTECT_MASK="/etc/php/cli-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/apache2-php5/ext-active/"
diff --git a/dev-lang/php/files/70_mod_php.conf-apache2 b/dev-lang/php/files/70_mod_php.conf-apache2
new file mode 100644
index 0000000..90cabfb
--- /dev/null
+++ b/dev-lang/php/files/70_mod_php.conf-apache2
@@ -0,0 +1,17 @@
+<IfDefine PHP4>
+	# Load the module first
+	<IfModule !sapi_apache2.c>
+		LoadModule php4_module    modules/libphp4.so
+	</IfModule>
+
+	# Set it to handle the files
+	<IfModule mod_mime.c>
+		AddType application/x-httpd-php .php
+		AddType application/x-httpd-php .phtml
+		AddType application/x-httpd-php .php3
+		AddType application/x-httpd-php .php4
+		AddType application/x-httpd-php-source .phps
+	</IfModule>
+
+	DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/dev-lang/php/files/70_mod_php5.conf-apache2-r1 b/dev-lang/php/files/70_mod_php5.conf-apache2-r1
new file mode 100644
index 0000000..50911ad
--- /dev/null
+++ b/dev-lang/php/files/70_mod_php5.conf-apache2-r1
@@ -0,0 +1,17 @@
+<IfDefine PHP5>
+	# Load the module first
+	<IfModule !mod_php5.c>
+		LoadModule php5_module    modules/libphp5.so
+	</IfModule>
+
+	# Set it to handle the files
+	<FilesMatch "\.ph(p5?|tml)$">
+		SetHandler application/x-httpd-php
+	</FilesMatch>
+
+	<FilesMatch "\.phps$">
+		SetHandler application/x-httpd-php-source
+	</FilesMatch>
+
+	DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/dev-lang/php/files/70_mod_php5_concurr.conf-apache2-r1 b/dev-lang/php/files/70_mod_php5_concurr.conf-apache2-r1
new file mode 100644
index 0000000..cd1c380
--- /dev/null
+++ b/dev-lang/php/files/70_mod_php5_concurr.conf-apache2-r1
@@ -0,0 +1,17 @@
+<IfDefine PHP5>
+	# Load the module first
+	<IfModule !mod_php5.c>
+		LoadModule php5_module    modules/libphp5.so
+	</IfModule>
+
+	# Set it to handle the files
+	<FilesMatch "\.ph(p5?|tml)$">
+		SetHandler application/x-httpd-php5
+	</FilesMatch>
+
+	<FilesMatch "\.phps$">
+		SetHandler application/x-httpd-php5-source
+	</FilesMatch>
+
+	DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/dev-lang/php/files/70_mod_php_concurr.conf-apache2 b/dev-lang/php/files/70_mod_php_concurr.conf-apache2
new file mode 100644
index 0000000..fa73e76
--- /dev/null
+++ b/dev-lang/php/files/70_mod_php_concurr.conf-apache2
@@ -0,0 +1,14 @@
+<IfDefine PHP4>
+	# Load the module first
+	<IfModule !sapi_apache2.c>
+		LoadModule php4_module    modules/libphp4.so
+	</IfModule>
+
+	# Set it to handle the files
+	<IfModule mod_mime.c>
+		AddType application/x-httpd-php4 .php3
+		AddType application/x-httpd-php4 .php4
+	</IfModule>
+
+	DirectoryIndex index.php index.phtml
+</IfDefine>
diff --git a/dev-lang/php/files/eblits/common-v1.eblit b/dev-lang/php/files/eblits/common-v1.eblit
new file mode 100644
index 0000000..ae21475
--- /dev/null
+++ b/dev-lang/php/files/eblits/common-v1.eblit
@@ -0,0 +1,9 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/common-v1.eblit,v 1.2 2010/10/08 18:25:10 olemarkus Exp $
+
+php_set_ini_dir() {
+	PHP_INI_DIR="/etc/php/${1}-php${SLOT}"
+	PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
+	PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
+}
diff --git a/dev-lang/php/files/eblits/common-v2.eblit b/dev-lang/php/files/eblits/common-v2.eblit
new file mode 100644
index 0000000..394dacb
--- /dev/null
+++ b/dev-lang/php/files/eblits/common-v2.eblit
@@ -0,0 +1,9 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/common-v2.eblit,v 1.3 2010/10/08 18:25:10 olemarkus Exp $
+
+php_set_ini_dir() {
+	PHP_INI_DIR="/etc/php/${1}-php${SLOT}"
+	PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
+	PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
+}
diff --git a/dev-lang/php/files/eblits/pkg_postinst-v1.eblit b/dev-lang/php/files/eblits/pkg_postinst-v1.eblit
new file mode 100644
index 0000000..c19dd9a
--- /dev/null
+++ b/dev-lang/php/files/eblits/pkg_postinst-v1.eblit
@@ -0,0 +1,76 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_postinst-v1.eblit,v 1.4 2011/02/16 08:12:28 olemarkus Exp $
+
+eblit-php-pkg_postinst() {
+	# Output some general info to the user
+	if use apache2 ; then
+		APACHE2_MOD_DEFINE="PHP${PHP_MV}"
+		if use concurrentmodphp ; then
+			APACHE2_MOD_CONF="70_mod_php${PHP_MV}_concurr"
+		else
+			APACHE2_MOD_CONF="70_mod_php${PHP_MV}"
+		fi
+		apache-module_pkg_postinst
+	fi
+
+	# Update Apache2 to use mod_php
+	if use apache2 ; then
+		"${ROOT}/usr/sbin/php-select" -t apache2 php${PHP_MV} > /dev/null 2>&1
+		exitStatus=$?
+		if [[ ${exitStatus} == 2 ]] ; then
+			php-select apache2 php${PHP_MV}
+		elif [[ ${exitStatus} == 4 ]] ; then
+			ewarn "To make Apache2 use php-${PHP_MV}, use"
+			ewarn "    php-select apache2 php${PHP_MV}"
+			ewarn
+		fi
+	fi
+
+	# Create the symlinks for php-cli
+	if use cli ; then
+		"${ROOT}/usr/sbin/php-select" -t php php${PHP_MV} > /dev/null 2>&1
+		exitStatus=$?
+		if [[ ${exitStatus} == 5 ]] ; then
+			php-select php php${PHP_MV}
+		elif [[ ${exitStatus} == 4 ]] ; then
+			ewarn "To make usr/bin/php point to php-${PHP_MV}, use"
+			ewarn "    php-select php php${PHP_MV}"
+			ewarn
+		fi
+	fi
+
+	# Create the symlinks for php-cgi
+	if use cgi ; then
+		"${ROOT}/usr/sbin/php-select" -t php-cgi php${PHP_MV} > /dev/null 2>&1
+		exitStatus=$?
+		if [[ ${exitStatus} == 5 ]] ; then
+			php-select php-cgi php${PHP_MV}
+		elif [[ ${exitStatus} == 4 ]] ; then
+			ewarn "To make usr/bin/php-cgi point to php-${PHP_MV}, use"
+			ewarn "    php-select php-cgi php${PHP_MV}"
+			ewarn
+		fi
+	fi
+
+	# Create the symlinks for php-devel
+	"${ROOT}/usr/sbin/php-select" -t php-devel php${PHP_MV} > /dev/null 2>&1
+	exitStatus=$?
+	if [[ $exitStatus == 5 ]] ; then
+		php-select php-devel php${PHP_MV}
+	elif [[ $exitStatus == 4 ]] ; then
+		ewarn "To make usr/bin/php-config and usr/bin/phpize point to php-${PHP_MV}, use"
+		ewarn "    php-select php-devel php${PHP_MV}"
+		ewarn
+	fi
+
+	ewarn "You may have to recompile third-party extensions now"
+	ewarn "(includes every dev-php5/pecl-* package and probably others in that category)"
+	ewarn "Also make sure that you merge in the correct extension_dir ini setting for all your"
+	ewarn "php.ini files."
+	ewarn 
+	ewarn "Please read the upgrade guide: http://www.gentoo.org/proj/en/php/php-upgrading.xml"
+	ewarn
+}
+
+
diff --git a/dev-lang/php/files/eblits/pkg_postinst-v2.eblit b/dev-lang/php/files/eblits/pkg_postinst-v2.eblit
new file mode 100644
index 0000000..70bb7e8
--- /dev/null
+++ b/dev-lang/php/files/eblits/pkg_postinst-v2.eblit
@@ -0,0 +1,64 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_postinst-v2.eblit,v 1.12 2011/02/18 09:18:38 olemarkus Exp $
+
+eblit-php-pkg_postinst() {
+	# Output some general info to the user
+	if use apache2 ; then
+		APACHE2_MOD_DEFINE="PHP5"
+		APACHE2_MOD_CONF="70_mod_php5"
+		apache-module_pkg_postinst
+	fi
+
+	
+	# Create the symlinks for php
+	for m in ${SAPIS}; do
+		[[ ${m} == 'embed' ]] && continue;
+		if use $m ; then
+			local ci=$(eselect php show $m)
+			if [[ -z $ci ]]; then
+				eselect php set $m php${SLOT}
+				einfo "Switched ${m} to use php:${SLOT}"
+				einfo
+			elif [[ $ci != "php${SLOT}" ]] ; then
+				elog "To switch $m to use php:${SLOT}, run"
+				elog "    eselect php set $m php${SLOT}"
+				elog
+			fi
+		fi
+	done
+
+	elog "You may have to recompile third-party extensions now"
+	elog "(includes every dev-php5/pecl-* package and probably others in that category)"
+	elog "Make sure that PHP_TARGETS in /etc/make.conf includes php${SLOT/./-} in order"
+	elog "to compile extensions for the ${SLOT} ABI"
+	elog
+	if ! use readline && use cli ; then
+		ewarn "Note that in order to use php interactivly, you need to enable"
+		ewarn "the readline USE flag or php -a will hang"
+	fi
+	elog
+	elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
+	elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
+	elog "'production' or 'development' in /etc/make.conf"
+	ewarn "Both versions of php.ini can be found in /usr/share/doc/${PF}"
+
+	# check for not yet migrated old style config dirs
+	ls "${ROOT}"/etc/php/*-php5 &>/dev/null
+	if [[ $? -eq 0 ]]; then
+		ewarn "Make sure to migrate your config files, starting with php-5.3.4 and php-5.2.16 config"
+		ewarn "files are now kept at ${ROOT}etc/php/{apache2,cli,cgi,fpm}-php5.x"
+	fi
+	elog
+	elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
+	elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
+	elog
+
+	if ( [[ -z SUHOSIN_VERSION ]] && use suhosin && version_is_at_least 5.3.6_rc1 ) ; then
+		ewarn "The suhosin USE flag now only installs the suhosin patch!"
+		ewarn "If you want the suhosin extension, make sure you install"
+		ewarn " dev-php5/suhosin"
+		ewarn
+	fi
+}
+
diff --git a/dev-lang/php/files/eblits/pkg_setup-v1.eblit b/dev-lang/php/files/eblits/pkg_setup-v1.eblit
new file mode 100644
index 0000000..f487a0b
--- /dev/null
+++ b/dev-lang/php/files/eblits/pkg_setup-v1.eblit
@@ -0,0 +1,28 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_setup-v1.eblit,v 1.2 2010/07/08 22:39:52 mabi Exp $
+
+eblit-php-pkg_setup() {
+	if use concurrentmodphp || use kolab ; then
+		ewarn "concurrentmodphp and kolab are Gentoo-specific experimental"
+		ewarn "patches. Before reporting any bugs to bugs.php.net, make sure to"
+		ewarn "rebuild PHP with those USE flags disabled"
+		ewarn
+	fi
+
+	# Mail support
+	php_check_mta
+
+	# imap support
+	# if virtuals/imap-c-client goes to new style virtual, we  can exchange this
+	# for proper use-deps
+	php_check_imap
+
+	# Oracle support
+	php_check_oracle_8
+
+	phpconfutils_warn_about_external_deps
+	depend.apache_pkg_setup
+}
+
+
diff --git a/dev-lang/php/files/eblits/pkg_setup-v2.eblit b/dev-lang/php/files/eblits/pkg_setup-v2.eblit
new file mode 100644
index 0000000..a5218b3
--- /dev/null
+++ b/dev-lang/php/files/eblits/pkg_setup-v2.eblit
@@ -0,0 +1,16 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_setup-v2.eblit,v 1.2 2011/03/17 16:34:47 olemarkus Exp $
+
+eblit-php-pkg_setup() {
+	# Mail support
+	php_check_mta
+
+	# Oracle support
+	php_check_oracle_8
+
+	phpconfutils_warn_about_external_deps
+	depend.apache_pkg_setup
+}
+
+
diff --git a/dev-lang/php/files/eblits/pkg_setup-v3.eblit b/dev-lang/php/files/eblits/pkg_setup-v3.eblit
new file mode 100644
index 0000000..ca81906
--- /dev/null
+++ b/dev-lang/php/files/eblits/pkg_setup-v3.eblit
@@ -0,0 +1,9 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/pkg_setup-v3.eblit,v 1.1 2011/07/02 15:14:41 olemarkus Exp $
+
+eblit-php-pkg_setup() {
+	depend.apache_pkg_setup
+}
+
+
diff --git a/dev-lang/php/files/eblits/src_compile-v1.eblit b/dev-lang/php/files/eblits/src_compile-v1.eblit
new file mode 100644
index 0000000..cb0d56c
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_compile-v1.eblit
@@ -0,0 +1,60 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_compile-v1.eblit,v 1.6 2010/08/14 19:37:31 mabi Exp $
+
+eblit-php-src_compile() {
+	# snmp seems to run during src_compile, too (bug #324739)
+	addpredict /usr/share/snmp/mibs/.index
+
+	SAPI_DIR="${WORKDIR}/sapis"
+
+	for sapi in ${SAPIS} ; do
+		use "${sapi}" || continue
+
+		php_sapi_build "${sapi}"
+		php_sapi_copy "${sapi}"
+	done
+}
+
+php_sapi_build() {
+	mkdir -p "${SAPI_DIR}/$1"
+
+	cd "${WORKDIR}/sapis-build/$1"
+	emake || die "emake failed"
+}
+
+php_sapi_copy() {
+	local sapi="$1"
+	local source=""
+
+	case "$sapi" in
+		cli)
+			source="sapi/cli/php"
+			;;
+		cgi)
+			source="sapi/cgi/php-cgi"
+			;;
+		fpm)
+			source="sapi/fpm/php-fpm"
+			;;
+		embed)
+			source="libs/libphp${PHP_MV}.so"
+			;;
+
+		apache2)
+			# apache2 is a special case; the necessary files
+			# (yes, multiple) are copied by make install, not
+			# by the ebuild; that's the reason, why apache2 has
+			# to be the last sapi
+			emake INSTALL_ROOT="${SAPI_DIR}/${sapi}/" install-sapi
+			;;
+
+		*)
+			die "unhandled sapi in php_sapi_copy"
+			;;
+	esac
+
+	if [[ "${source}" ]] ; then
+		cp "$source" "${SAPI_DIR}/$sapi" || die "Unable to copy ${sapi} SAPI"
+	fi
+}
diff --git a/dev-lang/php/files/eblits/src_compile-v2.eblit b/dev-lang/php/files/eblits/src_compile-v2.eblit
new file mode 100644
index 0000000..6e3d277
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_compile-v2.eblit
@@ -0,0 +1,17 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_compile-v2.eblit,v 1.3 2011/10/31 16:18:04 mabi Exp $
+
+eblit-php-src_compile() {
+	# snmp seems to run during src_compile, too (bug #324739)
+	addpredict /usr/share/snmp/mibs/.index
+
+	for sapi in ${SAPIS} ; do
+		use "${sapi}" && php_sapi_build "${sapi}"
+	done
+}
+
+php_sapi_build() {
+	cd "${WORKDIR}/sapis-build/$1"
+	emake || die "emake failed"
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v1.eblit b/dev-lang/php/files/eblits/src_configure-v1.eblit
new file mode 100644
index 0000000..09838bd
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v1.eblit
@@ -0,0 +1,280 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v1.eblit,v 1.8 2010/10/24 11:48:42 mabi Exp $
+
+eblit-php-src_configure() {
+	PHP_DESTDIR="/usr/$(get_libdir)/php${PHP_MV}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	# for --with-libdir see bug #327025
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	phpconfutils_init
+
+	#                             extension	      USE flag        shared
+	phpconfutils_extension_enable  "bcmath"       "bcmath"           1
+	phpconfutils_extension_with    "bz2"          "bzip2"            1
+	phpconfutils_extension_enable  "calendar"     "calendar"         1
+	phpconfutils_extension_disable "ctype"        "ctype"            0
+	phpconfutils_extension_with    "curl"         "curl"             1
+	phpconfutils_extension_with    "curlwrappers" "curlwrappers"     0
+	phpconfutils_extension_disable "dom"          "xml"              0
+	phpconfutils_extension_with    "enchant"      "enchant"          1 "/usr"
+	phpconfutils_extension_enable  "exif"         "exif"             1
+	phpconfutils_extension_disable "fileinfo"     "fileinfo"         1
+	phpconfutils_extension_disable "filter"       "filter"           0
+	phpconfutils_extension_enable  "ftp"          "ftp"              1
+	phpconfutils_extension_with    "gettext"      "nls"              1
+	phpconfutils_extension_with    "gmp"          "gmp"              1
+	phpconfutils_extension_disable "hash"         "hash"             0
+	phpconfutils_extension_without "iconv"        "iconv"            0
+	phpconfutils_extension_enable  "intl"         "intl"             1
+	phpconfutils_extension_disable "ipv6"         "ipv6"             0
+	phpconfutils_extension_disable "json"         "json"             0
+	phpconfutils_extension_with    "kerberos"     "kerberos"         0 "/usr"
+	phpconfutils_extension_disable "libxml"       "xml"              0
+	phpconfutils_extension_enable  "mbstring"     "unicode"          1
+	phpconfutils_extension_with    "mcrypt"       "crypt"            1
+	phpconfutils_extension_with    "mssql"        "mssql"            1
+	phpconfutils_extension_with    "onig"         "unicode"          0 "/usr"
+	phpconfutils_extension_with    "openssl"      "ssl"              0
+	phpconfutils_extension_with    "openssl-dir"  "ssl"              0 "/usr"
+	phpconfutils_extension_enable  "pcntl"        "pcntl"            1
+	phpconfutils_extension_disable "phar"         "phar"             1
+	phpconfutils_extension_disable "pdo"          "pdo"              0
+	phpconfutils_extension_with    "pgsql"        "postgres"         1
+	phpconfutils_extension_disable "posix"        "posix"            0
+	phpconfutils_extension_with    "pspell"       "spell"            1
+	phpconfutils_extension_with    "recode"       "recode"           1
+	phpconfutils_extension_disable "simplexml"    "simplexml"        0
+	phpconfutils_extension_enable  "shmop"        "sharedmem"        0
+	phpconfutils_extension_with    "snmp"         "snmp"             1
+	phpconfutils_extension_enable  "soap"         "soap"             1
+	phpconfutils_extension_enable  "sockets"      "sockets"          1
+	phpconfutils_extension_without "sqlite3"      "sqlite3"          1 "/usr"
+	phpconfutils_extension_with    "sybase-ct"    "sybase-ct"        1
+	phpconfutils_extension_enable  "sysvmsg"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvsem"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvshm"      "sysvipc"          1
+	phpconfutils_extension_with    "tidy"         "tidy"             1
+	phpconfutils_extension_disable "tokenizer"    "tokenizer"        0
+	phpconfutils_extension_enable  "wddx"         "wddx"             1
+	phpconfutils_extension_disable "xml"          "xml"              0
+	phpconfutils_extension_disable "xmlreader"    "xmlreader"        0
+	phpconfutils_extension_disable "xmlwriter"    "xmlwriter"        0
+	phpconfutils_extension_with    "xmlrpc"       "xmlrpc"           1
+	phpconfutils_extension_with    "xsl"          "xsl"              1
+	phpconfutils_extension_enable  "zip"          "zip"              1
+	phpconfutils_extension_with    "zlib"         "zlib"             1
+	phpconfutils_extension_enable  "debug"        "debug"            0
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	phpconfutils_extension_with   "cdb"        "cdb"      0
+	phpconfutils_extension_with   "db4"        "berkdb"   0
+	phpconfutils_extension_enable "flatfile"   "flatfile" 0
+	phpconfutils_extension_with   "gdbm"       "gdbm"     0
+	phpconfutils_extension_enable "inifile"    "inifile"  0
+	phpconfutils_extension_with   "qdbm"       "qdbm"     0
+
+	# Support for the GD graphics library
+	if use gd-external ; then
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "gd"           "gd-external" 1 "/usr"
+	else
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "jpeg-dir"     "gd"          0 "/usr"
+		phpconfutils_extension_with   "png-dir"      "gd"          0 "/usr"
+		phpconfutils_extension_with   "xpm-dir"      "xpm"         0 "/usr"
+		# enable gd last, so configure can pick up the previous settings
+		phpconfutils_extension_with   "gd"           "gd"          0
+	fi
+
+	# IMAP support
+	if use imap ; then
+		phpconfutils_extension_with "imap"     "imap" 1
+		phpconfutils_extension_with "imap-ssl" "ssl"  0
+	fi
+
+	phpconfutils_extension_with "interbase"	"interbase"	0 "/opt"
+	phpconfutils_extension_with	"interbase"	"firebird"	0 "/usr"
+
+	# LDAP support
+	if use ldap ; then
+		if use oci8 ; then
+			phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}"
+		else
+			phpconfutils_extension_with "ldap"      "ldap"      1
+			phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0
+		fi
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		if use mysqlnd ; then
+			phpconfutils_extension_with "mysql"      "mysql" 1 "mysqlnd"
+		else
+			phpconfutils_extension_with "mysql"      "mysql" 1 "/usr"
+		fi
+		phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
+	fi
+
+	# MySQLi support
+	if use mysqlnd ; then
+		phpconfutils_extension_with "mysqli" "mysqli" 1 "mysqlnd"
+	else
+		phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
+	fi
+
+	# ODBC support
+	if use odbc ; then
+		phpconfutils_extension_with "unixODBC" "odbc"     1 "/usr"
+		phpconfutils_extension_with "adabas"   "adabas"   1
+		phpconfutils_extension_with "birdstep" "birdstep" 1
+		phpconfutils_extension_with "dbmaker"  "dbmaker"  1
+		phpconfutils_extension_with "empress"  "empress"  1
+		if use empress ; then
+			phpconfutils_extension_with "empress-bcs" "empress-bcs" 0
+		fi
+		phpconfutils_extension_with "esoob"   "esoob" 1
+		# Needed to run conftest for IBM DB2
+		[[ -n ${DB2_HOME} ]] && export LD_LIBRARY_PATH="${DB2_HOME}/`get_libdir`"
+		phpconfutils_extension_with "ibm-db2" "db2"   1 "${DB2_HOME}"
+		phpconfutils_extension_with "sapdb"   "sapdb" 1
+		phpconfutils_extension_with "solid"   "solid" 1
+	fi
+
+	if use iodbc ; then
+		phpconfutils_extension_with "iodbc"   "iodbc" 1 "/usr"
+	fi
+
+	# Oracle support
+	phpconfutils_extension_with "oci8" "oci8" 1
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+
+		phpconfutils_extension_with "oci8" "oci8-instant-client" 1 \
+			"instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib"
+	fi
+
+	# PDO support
+	if use pdo ; then
+		phpconfutils_extension_with "pdo-dblib"  "mssql"    1
+		if use mysqlnd ; then
+			phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "mysqlnd"
+		else
+			phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "/usr"
+		fi
+		phpconfutils_extension_with "pdo-pgsql"  "postgres"	1
+		phpconfutils_extension_with "pdo-sqlite" "sqlite3"   1 "/usr"
+		phpconfutils_extension_with "pdo-odbc"   "odbc"     1 "unixODBC,/usr"
+		if use oci8 ; then
+			phpconfutils_extension_with "pdo-oci" "oci8" 1
+		fi
+		if use oci8-instant-client ; then
+			phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 \
+				"instantclient,/usr,${OCI8IC_PKG}"
+		fi
+	fi
+
+	# readline/libedit support
+	phpconfutils_extension_with "readline" "readline" 0
+	phpconfutils_extension_with "libedit"  "libedit"  0
+
+	# Session support
+	if use session ; then
+		phpconfutils_extension_with "mm" "sharedmem" 0
+	else
+		phpconfutils_extension_disable "session" "session" 0
+	fi
+
+	# SQLite support
+	if use sqlite ; then
+		phpconfutils_extension_with   "sqlite"      "sqlite"  0 "/usr"
+		phpconfutils_extension_enable "sqlite-utf8" "unicode" 0
+	else
+		phpconfutils_extension_without "sqlite" "sqlite" 0
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	if has fpm ${IUSE//+} && use fpm ; then
+		my_conf="${my_conf} --with-libevent-dir=/usr/`get_libdir`"
+	fi
+
+
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+
+	# Catch CFLAGS problems
+	php_check_cflags
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+	if use apache2 ; then
+		# Concurrent PHP Apache2 modules support
+		if use concurrentmodphp ; then
+			append-ldflags "-Wl,--version-script=${FILESDIR}/php${PHP_MV}-ldvs"
+		fi
+	fi
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|cgi|embed|fpm)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v2.eblit b/dev-lang/php/files/eblits/src_configure-v2.eblit
new file mode 100644
index 0000000..ab09832
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v2.eblit
@@ -0,0 +1,276 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v2.eblit,v 1.5 2011/01/05 11:23:16 mabi Exp $
+
+eblit-php-src_configure() {
+	PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	# for --with-libdir see bug #327025
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	phpconfutils_init
+
+	#                             extension	      USE flag        shared
+	phpconfutils_extension_enable  "bcmath"       "bcmath"           1
+	phpconfutils_extension_with    "bz2"          "bzip2"            1
+	phpconfutils_extension_enable  "calendar"     "calendar"         1
+	phpconfutils_extension_disable "ctype"        "ctype"            0
+	phpconfutils_extension_with    "curl"         "curl"             1
+	phpconfutils_extension_with    "curlwrappers" "curlwrappers"     0
+	phpconfutils_extension_disable "dom"          "xml"              0
+	phpconfutils_extension_with    "enchant"      "enchant"          1 "/usr"
+	phpconfutils_extension_enable  "exif"         "exif"             1
+	phpconfutils_extension_disable "fileinfo"     "fileinfo"         1
+	phpconfutils_extension_disable "filter"       "filter"           0
+	phpconfutils_extension_enable  "ftp"          "ftp"              1
+	phpconfutils_extension_with    "gettext"      "nls"              1
+	phpconfutils_extension_with    "gmp"          "gmp"              1
+	phpconfutils_extension_disable "hash"         "hash"             0
+	phpconfutils_extension_with    "mhash"        "mhash"            0
+	phpconfutils_extension_without "iconv"        "iconv"            0
+	phpconfutils_extension_enable  "intl"         "intl"             1
+	phpconfutils_extension_disable "ipv6"         "ipv6"             0
+	phpconfutils_extension_disable "json"         "json"             0
+	phpconfutils_extension_with    "kerberos"     "kerberos"         0 "/usr"
+	phpconfutils_extension_disable "libxml"       "xml"              0
+	phpconfutils_extension_enable  "mbstring"     "unicode"          1
+	phpconfutils_extension_with    "mcrypt"       "crypt"            1
+	phpconfutils_extension_with    "mssql"        "mssql"            1
+	phpconfutils_extension_with    "onig"         "unicode"          0 "/usr"
+	phpconfutils_extension_with    "openssl"      "ssl"              0
+	phpconfutils_extension_with    "openssl-dir"  "ssl"              0 "/usr"
+	phpconfutils_extension_enable  "pcntl"        "pcntl"            1
+	phpconfutils_extension_disable "phar"         "phar"             1
+	phpconfutils_extension_disable "pdo"          "pdo"              0
+	phpconfutils_extension_with    "pgsql"        "postgres"         1
+	phpconfutils_extension_disable "posix"        "posix"            0
+	phpconfutils_extension_with    "pspell"       "spell"            1
+	phpconfutils_extension_with    "recode"       "recode"           1
+	phpconfutils_extension_disable "simplexml"    "simplexml"        0
+	phpconfutils_extension_enable  "shmop"        "sharedmem"        0
+	phpconfutils_extension_with    "snmp"         "snmp"             1
+	phpconfutils_extension_enable  "soap"         "soap"             1
+	phpconfutils_extension_enable  "sockets"      "sockets"          1
+	phpconfutils_extension_without "sqlite3"      "sqlite3"          1 "/usr"
+	phpconfutils_extension_with    "sybase-ct"    "sybase-ct"        1 "/usr"
+	phpconfutils_extension_enable  "sysvmsg"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvsem"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvshm"      "sysvipc"          1
+	phpconfutils_extension_with    "tidy"         "tidy"             1
+	phpconfutils_extension_disable "tokenizer"    "tokenizer"        0
+	phpconfutils_extension_enable  "wddx"         "wddx"             1
+	phpconfutils_extension_disable "xml"          "xml"              0
+	phpconfutils_extension_disable "xmlreader"    "xmlreader"        0
+	phpconfutils_extension_disable "xmlwriter"    "xmlwriter"        0
+	phpconfutils_extension_with    "xmlrpc"       "xmlrpc"           1
+	phpconfutils_extension_with    "xsl"          "xsl"              1
+	phpconfutils_extension_enable  "zip"          "zip"              1
+	phpconfutils_extension_with    "zlib"         "zlib"             1
+	phpconfutils_extension_enable  "debug"        "debug"            0
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	phpconfutils_extension_with   "cdb"        "cdb"      0
+	phpconfutils_extension_with   "db4"        "berkdb"   0
+	phpconfutils_extension_enable "flatfile"   "flatfile" 0
+	phpconfutils_extension_with   "gdbm"       "gdbm"     0
+	phpconfutils_extension_enable "inifile"    "inifile"  0
+	phpconfutils_extension_with   "qdbm"       "qdbm"     0
+
+	# Support for the GD graphics library
+	if use gd-external ; then
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "gd"           "gd-external" 1 "/usr"
+	else
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "jpeg-dir"     "gd"          0 "/usr"
+		phpconfutils_extension_with   "png-dir"      "gd"          0 "/usr"
+		phpconfutils_extension_with   "xpm-dir"      "xpm"         0 "/usr"
+		# enable gd last, so configure can pick up the previous settings
+		phpconfutils_extension_with   "gd"           "gd"          0
+	fi
+
+	# IMAP support
+	if use imap ; then
+		phpconfutils_extension_with "imap"     "imap" 1
+		phpconfutils_extension_with "imap-ssl" "ssl"  0
+	fi
+
+	# Interbase/firebird support
+	if use interbase ; then
+		phpconfutils_extension_with "interbase"	"interbase"	0 "/opt"
+	fi
+
+	if use firebird ; then
+		phpconfutils_extension_with	"interbase"	"firebird"	0 "/usr"
+	fi
+
+	# LDAP support
+	if use ldap ; then
+		if use oci8 ; then
+			phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}"
+		else
+			phpconfutils_extension_with "ldap"      "ldap"      1
+			phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0
+		fi
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		if use mysqlnd ; then
+			phpconfutils_extension_with "mysql"      "mysql" 1 "mysqlnd"
+		else
+			phpconfutils_extension_with "mysql"      "mysql" 1 "/usr"
+		fi
+		phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
+	fi
+
+	# MySQLi support
+	if use mysqlnd ; then
+		phpconfutils_extension_with "mysqli" "mysqli" 1 "mysqlnd"
+	else
+		phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
+	fi
+
+	# ODBC support
+	if use odbc ; then
+		phpconfutils_extension_with "unixODBC" "odbc"     1 "/usr"
+		phpconfutils_extension_with "adabas"   "adabas"   1
+		phpconfutils_extension_with "birdstep" "birdstep" 1
+		phpconfutils_extension_with "dbmaker"  "dbmaker"  1
+		phpconfutils_extension_with "empress"  "empress"  1
+		if use empress ; then
+			phpconfutils_extension_with "empress-bcs" "empress-bcs" 0
+		fi
+		phpconfutils_extension_with "esoob"   "esoob" 1
+		# Needed to run conftest for IBM DB2
+		[[ -n ${DB2_HOME} ]] && export LD_LIBRARY_PATH="${DB2_HOME}/`get_libdir`"
+		phpconfutils_extension_with "ibm-db2" "db2"   1 "${DB2_HOME}"
+		phpconfutils_extension_with "sapdb"   "sapdb" 1
+		phpconfutils_extension_with "solid"   "solid" 1
+	fi
+
+	if use iodbc ; then
+		phpconfutils_extension_with "iodbc"   "iodbc" 1 "/usr"
+	fi
+
+	# Oracle support
+	phpconfutils_extension_with "oci8" "oci8" 1
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+
+		phpconfutils_extension_with "oci8" "oci8-instant-client" 1 \
+			"instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib"
+	fi
+
+	# PDO support
+	if use pdo ; then
+		phpconfutils_extension_with "pdo-dblib"  "mssql"    1
+		if use mysqlnd ; then
+			phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "mysqlnd"
+		else
+			phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "/usr"
+		fi
+		phpconfutils_extension_with "pdo-pgsql"  "postgres"	1
+		phpconfutils_extension_with "pdo-sqlite" "sqlite3"   1 "/usr"
+		phpconfutils_extension_with "pdo-odbc"   "odbc"     1 "unixODBC,/usr"
+		if use oci8 ; then
+			phpconfutils_extension_with "pdo-oci" "oci8" 1
+		fi
+		if use oci8-instant-client ; then
+			phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 \
+				"instantclient,/usr,${OCI8IC_PKG}"
+		fi
+	fi
+
+	# readline/libedit support
+	phpconfutils_extension_with "readline" "readline" 0
+	phpconfutils_extension_with "libedit"  "libedit"  0
+
+	# Session support
+	if use session ; then
+		phpconfutils_extension_with "mm" "sharedmem" 0
+	else
+		phpconfutils_extension_disable "session" "session" 0
+	fi
+
+	# SQLite support
+	if use sqlite ; then
+		phpconfutils_extension_with   "sqlite"      "sqlite"  0 "/usr"
+		phpconfutils_extension_enable "sqlite-utf8" "unicode" 0
+	else
+		phpconfutils_extension_without "sqlite" "sqlite" 0
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+
+	# Catch CFLAGS problems
+	php_check_cflags
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|cgi|embed|fpm)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v52.eblit b/dev-lang/php/files/eblits/src_configure-v52.eblit
new file mode 100644
index 0000000..73fecea
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v52.eblit
@@ -0,0 +1,279 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v52.eblit,v 1.5 2010/09/19 15:15:08 mabi Exp $
+
+eblit-php-src_configure() {
+	export CFLAGS="${CFLAGS} -D_GNU_SOURCE"
+	PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	phpconfutils_init
+
+	#                             extension	      USE flag        shared
+	phpconfutils_extension_enable  "bcmath"       "bcmath"           1
+	phpconfutils_extension_with    "bz2"          "bzip2"            1
+	phpconfutils_extension_enable  "calendar"     "calendar"         1
+	phpconfutils_extension_disable "ctype"        "ctype"            0
+	phpconfutils_extension_with    "curl"         "curl"             1
+	phpconfutils_extension_with    "curlwrappers" "curlwrappers"     0
+	phpconfutils_extension_enable  "dbase"	      "dbase"			 1
+	phpconfutils_extension_disable "dom"          "xml"              0
+	phpconfutils_extension_enable  "exif"         "exif"             1
+	phpconfutils_extension_with	   "fbsql"		  "frontbase"		 1
+	phpconfutils_extension_with	   "fdftk"		  "fdftk"			 1 "/opt/fdftk-6.0"
+	phpconfutils_extension_disable "filter"       "filter"           0
+	phpconfutils_extension_enable  "ftp"          "ftp"              1
+	phpconfutils_extension_with    "gettext"      "nls"              1
+	phpconfutils_extension_with    "gmp"          "gmp"              1
+	phpconfutils_extension_disable "hash"         "hash"             0
+	phpconfutils_extension_without "iconv"        "iconv"            0
+	phpconfutils_extension_disable "ipv6"         "ipv6"             0
+	phpconfutils_extension_disable "json"         "json"             0
+	phpconfutils_extension_with    "kerberos"     "kerberos"         0 "/usr"
+	phpconfutils_extension_disable "libxml"       "xml"              0
+	phpconfutils_extension_enable  "mbstring"     "unicode"          1
+	phpconfutils_extension_with    "mcrypt"       "crypt"            1
+	phpconfutils_extension_with	   "mhash"		  "mhash"			 1
+	phpconfutils_extension_with	   "msql"		  "msql"			 1
+	phpconfutils_extension_with    "mssql"        "mssql"            1
+	phpconfutils_extension_with	   "ncurses"	  "ncurses"		     1
+	phpconfutils_extension_with    "openssl"      "ssl"              0
+	phpconfutils_extension_with    "openssl-dir"  "ssl"              0 "/usr"
+	phpconfutils_extension_enable  "pcntl"        "pcntl"            1
+	phpconfutils_extension_without	"pcre-regex"  "pcre"			 0
+	phpconfutils_extension_disable "pdo"          "pdo"              0
+	phpconfutils_extension_with    "pgsql"        "postgres"         1
+	phpconfutils_extension_disable "posix"        "posix"            0
+	phpconfutils_extension_with    "pspell"       "spell"            1
+	phpconfutils_extension_with    "recode"       "recode"           1
+	phpconfutils_extension_disable "reflection"   "reflection"       0
+	phpconfutils_extension_disable "simplexml"    "simplexml"        0
+	phpconfutils_extension_enable  "shmop"        "sharedmem"        0
+	phpconfutils_extension_with    "snmp"         "snmp"             1
+	phpconfutils_extension_enable  "soap"         "soap"             1
+	phpconfutils_extension_enable  "sockets"      "sockets"          1
+	phpconfutils_extension_disable "spl"		  "spl"			     0
+	phpconfutils_extension_with    "sybase-ct"    "sybase-ct"        1
+	phpconfutils_extension_enable  "sysvmsg"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvsem"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvshm"      "sysvipc"          1
+	phpconfutils_extension_with    "tidy"         "tidy"             1
+	phpconfutils_extension_disable "tokenizer"    "tokenizer"        0
+	phpconfutils_extension_enable  "wddx"         "wddx"             1
+	phpconfutils_extension_disable "xml"          "xml"              0
+	phpconfutils_extension_disable "xmlreader"    "xmlreader"        0
+	phpconfutils_extension_disable "xmlwriter"    "xmlwriter"        0
+	phpconfutils_extension_with    "xmlrpc"       "xmlrpc"           1
+	phpconfutils_extension_with    "xsl"          "xsl"              1
+	phpconfutils_extension_enable  "zip"          "zip"              1
+	phpconfutils_extension_with    "zlib"         "zlib"             1
+	phpconfutils_extension_enable  "debug"        "debug"            0
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	phpconfutils_extension_with   "cdb"        "cdb"      0
+	phpconfutils_extension_with   "db4"        "berkdb"   0
+	phpconfutils_extension_enable "flatfile"   "flatfile" 0
+	phpconfutils_extension_with   "gdbm"       "gdbm"     0
+	phpconfutils_extension_enable "inifile"    "inifile"  0
+	phpconfutils_extension_with   "qdbm"       "qdbm"     0
+
+	# Support for the GD graphics library
+	if use gd-external ; then
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "gd"           "gd-external" 1 "/usr"
+	else
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "jpeg-dir"     "gd"          0 "/usr"
+		phpconfutils_extension_with   "png-dir"      "gd"          0 "/usr"
+		phpconfutils_extension_with   "xpm-dir"      "xpm"         0 "/usr"
+		# enable gd last, so configure can pick up the previous settings
+		phpconfutils_extension_with   "gd"           "gd"          0
+	fi
+
+	# IMAP support
+	if use imap ; then
+		phpconfutils_extension_with "imap"     "imap" 1
+		phpconfutils_extension_with "imap-ssl" "ssl"  0
+	fi
+
+	phpconfutils_extension_with "interbase"	"interbase"	0 "/opt"
+	phpconfutils_extension_with	"interbase"	"firebird"	0 "/usr"
+
+	# LDAP support
+	if use ldap ; then
+		if use oci8 ; then
+			phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}"
+		else
+			phpconfutils_extension_with "ldap"      "ldap"      1
+			phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0
+		fi
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		phpconfutils_extension_with "mysql"      "mysql" 1 "/usr"
+		phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
+	fi
+
+	# MySQLi support
+	phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
+
+	# ODBC support
+	if use odbc ; then
+		phpconfutils_extension_with "unixODBC" "odbc"     1 "/usr"
+		phpconfutils_extension_with "adabas"   "adabas"   1
+		phpconfutils_extension_with "birdstep" "birdstep" 1
+		phpconfutils_extension_with "dbmaker"  "dbmaker"  1
+		phpconfutils_extension_with "empress"  "empress"  1
+		if use empress ; then
+			phpconfutils_extension_with "empress-bcs" "empress-bcs" 0
+		fi
+		phpconfutils_extension_with "esoob"   "esoob" 1
+		# Needed to run conftest for IBM DB2
+		[[ -n ${DB2_HOME} ]] && export LD_LIBRARY_PATH="${DB2_HOME}/`get_libdir`"
+		phpconfutils_extension_with "ibm-db2" "db2"   1 "${DB2_HOME}"
+		phpconfutils_extension_with "sapdb"   "sapdb" 1
+		phpconfutils_extension_with "solid"   "solid" 1
+	fi
+
+	if use iodbc ; then
+		phpconfutils_extension_with "iodbc"   "iodbc" 1 "/usr"
+	fi
+
+	# Oracle support
+	phpconfutils_extension_with "oci8" "oci8" 1
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+
+		phpconfutils_extension_with "oci8" "oci8-instant-client" 1 \
+			"instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib"
+	fi
+
+	# PDO support
+	if use pdo ; then
+		phpconfutils_extension_with "pdo-dblib"  "mssql"    1
+		phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "/usr"
+		phpconfutils_extension_with "pdo-pgsql"  "postgres"	1
+		phpconfutils_extension_with "pdo-sqlite" "sqlite"   1 "/usr"
+		phpconfutils_extension_with "pdo-odbc"   "odbc"     1 "unixODBC,/usr"
+		if use oci8 ; then
+			phpconfutils_extension_with "pdo-oci" "oci8" 1
+		fi
+		if use oci8-instant-client ; then
+			phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 \
+				"instantclient,/usr,${OCI8IC_PKG}"
+		fi
+	fi
+
+	# readline/libedit support
+	phpconfutils_extension_with "readline" "readline" 0
+	phpconfutils_extension_with "libedit"  "libedit"  0
+
+	# Session support
+	if use session ; then
+		phpconfutils_extension_with "mm" "sharedmem" 0
+	else
+		phpconfutils_extension_disable "session" "session" 0
+	fi
+
+	# SQLite support
+	if use sqlite ; then
+		phpconfutils_extension_with   "sqlite"      "sqlite"  0 "/usr"
+		phpconfutils_extension_enable "sqlite-utf8" "unicode" 0
+	else
+		phpconfutils_extension_without "sqlite" "sqlite" 0
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	if use pcre ; then
+		my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+	fi
+
+	# Catch CFLAGS problems
+	php_check_cflags
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+	if use apache2 ; then
+		# Concurrent PHP Apache2 modules support
+		if use concurrentmodphp ; then
+			append-ldflags "-Wl,--version-script=${FILESDIR}/php${PHP_MV}-ldvs"
+		fi
+	fi
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|embed)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				cgi)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf+=" --enable-cgi --enable-fastcgi"
+						use discard-path && sapi_conf+=" --enable-discard-path"
+						use force-cgi-redirect && sapi_conf+=" --enable-force-cgi-redirect"
+					else
+						sapi_conf+=" --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v521.eblit b/dev-lang/php/files/eblits/src_configure-v521.eblit
new file mode 100644
index 0000000..61e6389
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v521.eblit
@@ -0,0 +1,273 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v521.eblit,v 1.1 2010/10/08 18:25:10 olemarkus Exp $
+
+eblit-php-src_configure() {
+	export CFLAGS="${CFLAGS} -D_GNU_SOURCE"
+	PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	phpconfutils_init
+
+	#                             extension	      USE flag        shared
+	phpconfutils_extension_enable  "bcmath"       "bcmath"           1
+	phpconfutils_extension_with    "bz2"          "bzip2"            1
+	phpconfutils_extension_enable  "calendar"     "calendar"         1
+	phpconfutils_extension_disable "ctype"        "ctype"            0
+	phpconfutils_extension_with    "curl"         "curl"             1
+	phpconfutils_extension_with    "curlwrappers" "curlwrappers"     0
+	phpconfutils_extension_enable  "dbase"	      "dbase"			 1
+	phpconfutils_extension_disable "dom"          "xml"              0
+	phpconfutils_extension_enable  "exif"         "exif"             1
+	phpconfutils_extension_with	   "fbsql"		  "frontbase"		 1
+	phpconfutils_extension_with	   "fdftk"		  "fdftk"			 1 "/opt/fdftk-6.0"
+	phpconfutils_extension_disable "filter"       "filter"           0
+	phpconfutils_extension_enable  "ftp"          "ftp"              1
+	phpconfutils_extension_with    "gettext"      "nls"              1
+	phpconfutils_extension_with    "gmp"          "gmp"              1
+	phpconfutils_extension_disable "hash"         "hash"             0
+	phpconfutils_extension_without "iconv"        "iconv"            0
+	phpconfutils_extension_disable "ipv6"         "ipv6"             0
+	phpconfutils_extension_disable "json"         "json"             0
+	phpconfutils_extension_with    "kerberos"     "kerberos"         0 "/usr"
+	phpconfutils_extension_disable "libxml"       "xml"              0
+	phpconfutils_extension_enable  "mbstring"     "unicode"          1
+	phpconfutils_extension_with    "mcrypt"       "crypt"            1
+	phpconfutils_extension_with	   "mhash"		  "mhash"			 1
+	phpconfutils_extension_with	   "msql"		  "msql"			 1
+	phpconfutils_extension_with    "mssql"        "mssql"            1
+	phpconfutils_extension_with	   "ncurses"	  "ncurses"		     1
+	phpconfutils_extension_with    "openssl"      "ssl"              0
+	phpconfutils_extension_with    "openssl-dir"  "ssl"              0 "/usr"
+	phpconfutils_extension_enable  "pcntl"        "pcntl"            1
+	phpconfutils_extension_without	"pcre-regex"  "pcre"			 0
+	phpconfutils_extension_disable "pdo"          "pdo"              0
+	phpconfutils_extension_with    "pgsql"        "postgres"         1
+	phpconfutils_extension_disable "posix"        "posix"            0
+	phpconfutils_extension_with    "pspell"       "spell"            1
+	phpconfutils_extension_with    "recode"       "recode"           1
+	phpconfutils_extension_disable "reflection"   "reflection"       0
+	phpconfutils_extension_disable "simplexml"    "simplexml"        0
+	phpconfutils_extension_enable  "shmop"        "sharedmem"        0
+	phpconfutils_extension_with    "snmp"         "snmp"             1
+	phpconfutils_extension_enable  "soap"         "soap"             1
+	phpconfutils_extension_enable  "sockets"      "sockets"          1
+	phpconfutils_extension_disable "spl"		  "spl"			     0
+	phpconfutils_extension_with    "sybase-ct"    "sybase-ct"        1
+	phpconfutils_extension_enable  "sysvmsg"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvsem"      "sysvipc"          1
+	phpconfutils_extension_enable  "sysvshm"      "sysvipc"          1
+	phpconfutils_extension_with    "tidy"         "tidy"             1
+	phpconfutils_extension_disable "tokenizer"    "tokenizer"        0
+	phpconfutils_extension_enable  "wddx"         "wddx"             1
+	phpconfutils_extension_disable "xml"          "xml"              0
+	phpconfutils_extension_disable "xmlreader"    "xmlreader"        0
+	phpconfutils_extension_disable "xmlwriter"    "xmlwriter"        0
+	phpconfutils_extension_with    "xmlrpc"       "xmlrpc"           1
+	phpconfutils_extension_with    "xsl"          "xsl"              1
+	phpconfutils_extension_enable  "zip"          "zip"              1
+	phpconfutils_extension_with    "zlib"         "zlib"             1
+	phpconfutils_extension_enable  "debug"        "debug"            0
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	phpconfutils_extension_with   "cdb"        "cdb"      0
+	phpconfutils_extension_with   "db4"        "berkdb"   0
+	phpconfutils_extension_enable "flatfile"   "flatfile" 0
+	phpconfutils_extension_with   "gdbm"       "gdbm"     0
+	phpconfutils_extension_enable "inifile"    "inifile"  0
+	phpconfutils_extension_with   "qdbm"       "qdbm"     0
+
+	# Support for the GD graphics library
+	if use gd-external ; then
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "gd"           "gd-external" 1 "/usr"
+	else
+		phpconfutils_extension_with   "freetype-dir" "truetype"    0 "/usr"
+		phpconfutils_extension_with   "t1lib"        "truetype"    0 "/usr"
+		phpconfutils_extension_enable "gd-jis-conv"  "cjk"         0
+		phpconfutils_extension_with   "jpeg-dir"     "gd"          0 "/usr"
+		phpconfutils_extension_with   "png-dir"      "gd"          0 "/usr"
+		phpconfutils_extension_with   "xpm-dir"      "xpm"         0 "/usr"
+		# enable gd last, so configure can pick up the previous settings
+		phpconfutils_extension_with   "gd"           "gd"          0
+	fi
+
+	# IMAP support
+	if use imap ; then
+		phpconfutils_extension_with "imap"     "imap" 1
+		phpconfutils_extension_with "imap-ssl" "ssl"  0
+	fi
+
+	phpconfutils_extension_with "interbase"	"interbase"	0 "/opt"
+	phpconfutils_extension_with	"interbase"	"firebird"	0 "/usr"
+
+	# LDAP support
+	if use ldap ; then
+		if use oci8 ; then
+			phpconfutils_extension_with "ldap" "ldap" 1 "${ORACLE_HOME}"
+		else
+			phpconfutils_extension_with "ldap"      "ldap"      1
+			phpconfutils_extension_with "ldap-sasl" "ldap-sasl" 0
+		fi
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		phpconfutils_extension_with "mysql"      "mysql" 1 "/usr"
+		phpconfutils_extension_with "mysql-sock" "mysql" 0 "/var/run/mysqld/mysqld.sock"
+	fi
+
+	# MySQLi support
+	phpconfutils_extension_with "mysqli" "mysqli" 1 "/usr/bin/mysql_config"
+
+	# ODBC support
+	if use odbc ; then
+		phpconfutils_extension_with "unixODBC" "odbc"     1 "/usr"
+		phpconfutils_extension_with "adabas"   "adabas"   1
+		phpconfutils_extension_with "birdstep" "birdstep" 1
+		phpconfutils_extension_with "dbmaker"  "dbmaker"  1
+		phpconfutils_extension_with "empress"  "empress"  1
+		if use empress ; then
+			phpconfutils_extension_with "empress-bcs" "empress-bcs" 0
+		fi
+		phpconfutils_extension_with "esoob"   "esoob" 1
+		# Needed to run conftest for IBM DB2
+		[[ -n ${DB2_HOME} ]] && export LD_LIBRARY_PATH="${DB2_HOME}/`get_libdir`"
+		phpconfutils_extension_with "ibm-db2" "db2"   1 "${DB2_HOME}"
+		phpconfutils_extension_with "sapdb"   "sapdb" 1
+		phpconfutils_extension_with "solid"   "solid" 1
+	fi
+
+	if use iodbc ; then
+		phpconfutils_extension_with "iodbc"   "iodbc" 1 "/usr"
+	fi
+
+	# Oracle support
+	phpconfutils_extension_with "oci8" "oci8" 1
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+
+		phpconfutils_extension_with "oci8" "oci8-instant-client" 1 \
+			"instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib"
+	fi
+
+	# PDO support
+	if use pdo ; then
+		phpconfutils_extension_with "pdo-dblib"  "mssql"    1
+		phpconfutils_extension_with "pdo-mysql"  "mysql"    1 "/usr"
+		phpconfutils_extension_with "pdo-pgsql"  "postgres"	1
+		phpconfutils_extension_with "pdo-sqlite" "sqlite"   1 "/usr"
+		phpconfutils_extension_with "pdo-odbc"   "odbc"     1 "unixODBC,/usr"
+		if use oci8 ; then
+			phpconfutils_extension_with "pdo-oci" "oci8" 1
+		fi
+		if use oci8-instant-client ; then
+			phpconfutils_extension_with "pdo-oci" "oci8-instant-client" 1 \
+				"instantclient,/usr,${OCI8IC_PKG}"
+		fi
+	fi
+
+	# readline/libedit support
+	phpconfutils_extension_with "readline" "readline" 0
+	phpconfutils_extension_with "libedit"  "libedit"  0
+
+	# Session support
+	if use session ; then
+		phpconfutils_extension_with "mm" "sharedmem" 0
+	else
+		phpconfutils_extension_disable "session" "session" 0
+	fi
+
+	# SQLite support
+	if use sqlite ; then
+		phpconfutils_extension_with   "sqlite"      "sqlite"  0 "/usr"
+		phpconfutils_extension_enable "sqlite-utf8" "unicode" 0
+	else
+		phpconfutils_extension_without "sqlite" "sqlite" 0
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	if use pcre ; then
+		my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+	fi
+
+	# Catch CFLAGS problems
+	php_check_cflags
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|embed)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				cgi)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf+=" --enable-cgi --enable-fastcgi"
+						use discard-path && sapi_conf+=" --enable-discard-path"
+						use force-cgi-redirect && sapi_conf+=" --enable-force-cgi-redirect"
+					else
+						sapi_conf+=" --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v53.eblit b/dev-lang/php/files/eblits/src_configure-v53.eblit
new file mode 100644
index 0000000..00b7275
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v53.eblit
@@ -0,0 +1,262 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v53.eblit,v 1.2 2011/12/23 17:16:42 olemarkus Exp $
+
+eblit-php-src_configure() {
+    addpredict /usr/share/snmp/mibs/.index
+
+	PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	# for --with-libdir see bug #327025
+	my_conf="--prefix=${PHP_DESTDIR}
+		--mandir=${PHP_DESTDIR}/man
+		--infodir=${PHP_DESTDIR}/info
+		--libdir=${PHP_DESTDIR}/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	#                             extension	      USE flag        shared
+	my_conf+="
+	$(use_enable bcmath bcmath )
+	$(use_with bzip2 bz2 )
+	$(use_enable calendar calendar )
+	$(use_enable ctype ctype )
+	$(use_with curl curl )
+	$(use_with curlwrappers curlwrappers )
+	$(use_enable xml dom )
+	$(use_with enchant enchant /usr)
+	$(use_enable exif exif )
+	$(use_enable fileinfo fileinfo )
+	$(use_enable filter filter )
+	$(use_enable ftp ftp )
+	$(use_with nls gettext )
+	$(use_with gmp gmp )
+	$(use_enable hash hash )
+	$(use_with mhash mhash )
+	$(use_with iconv iconv )
+	$(use_enable intl intl )
+	$(use_enable ipv6 ipv6 )
+	$(use_enable json json )
+	$(use_with kerberos kerberos /usr)
+	$(use_enable xml libxml )
+	$(use_enable unicode mbstring )
+	$(use_with crypt mcrypt )
+	$(use_with mssql mssql )
+	$(use_with unicode onig /usr)
+	$(use_with ssl openssl )
+	$(use_with ssl openssl-dir /usr)
+	$(use_enable pcntl pcntl )
+	$(use_enable phar phar )
+	$(use_enable pdo pdo )
+	$(use_with postgres pgsql )
+	$(use_enable posix posix )
+	$(use_with spell pspell )
+	$(use_with recode recode )
+	$(use_enable simplexml simplexml )
+	$(use_enable sharedmem shmop )
+	$(use_with snmp snmp )
+	$(use_enable soap soap )
+	$(use_enable sockets sockets )
+	$(use_with sqlite sqlite /usr)"
+    use sqlite && my_conf+=" $(use_enable unicode sqlite-utf8)"
+    my_conf+="
+	$(use_with sqlite3 sqlite3 /usr)
+	$(use_with sybase-ct sybase-ct /usr)
+	$(use_enable sysvipc sysvmsg )
+	$(use_enable sysvipc sysvsem )
+	$(use_enable sysvipc sysvshm )
+	$(use_with tidy tidy )
+	$(use_enable tokenizer tokenizer )
+	$(use_enable wddx wddx )
+	$(use_enable xml xml )
+	$(use_enable xmlreader xmlreader )
+	$(use_enable xmlwriter xmlwriter )
+	$(use_with xmlrpc xmlrpc )
+	$(use_with xsl xsl )
+	$(use_enable zip zip )
+	$(use_with zlib zlib )
+	$(use_enable debug debug )"
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	my_conf+="
+	$(use_with cdb cdb )
+	$(use_with berkdb db4 )
+	$(use_enable flatfile flatfile )
+	$(use_with gdbm gdbm )
+	$(use_enable inifile inifile )
+	$(use_with qdbm qdbm )"
+
+	# Support for the GD graphics library
+	my_conf+="
+	$(use_with truetype freetype-dir /usr)
+	$(use_with truetype t1lib /usr)
+	$(use_enable cjk gd-jis-conv )
+	$(use_with gd jpeg-dir /usr)
+	$(use_with gd png-dir /usr)
+	$(use_with xpm xpm-dir /usr)"
+	# enable gd last, so configure can pick up the previous settings
+	my_conf+="
+	$(use_with gd gd )"
+
+	# IMAP support
+	if use imap ; then
+	    my_conf+="
+		$(use_with imap imap )
+		$(use_with ssl imap-ssl )"
+	fi
+
+	# Interbase/firebird support
+	
+	if use firebird ; then
+	    my_conf+="
+		$(use_with firebird interbase /usr)"
+	fi
+
+	# LDAP support
+	if use ldap ; then
+	    my_conf+="
+		$(use_with ldap ldap )
+		$(use_with ldap-sasl ldap-sasl )"
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		if use mysqlnd ; then
+	        my_conf+="
+			$(use_with mysql mysql mysqlnd)"
+		else
+	        my_conf+="
+			$(use_with mysql mysql /usr)"
+		fi
+	    my_conf+="
+		$(use_with mysql mysql-sock /var/run/mysqld/mysqld.sock)"
+	fi
+
+	# MySQLi support
+	if use mysqlnd ; then
+	    my_conf+="
+		$(use_with mysqli mysqli mysqlnd)"
+	else
+	    my_conf+="
+		$(use_with mysqli mysqli /usr/bin/mysql_config)"
+	fi
+
+	# ODBC support
+	if use odbc ; then
+	    my_conf+="
+		$(use_with odbc unixODBC /usr)"
+	fi
+
+	if use iodbc ; then
+	    my_conf+="
+		$(use_with iodbc iodbc /usr)"
+	fi
+
+	# Oracle support
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+    
+	    my_conf+="
+		$(use_with oci8-instant-client oci8 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib")"
+	fi
+
+	# PDO support
+	if use pdo ; then
+	    my_conf+="
+		$(use_with mssql pdo-dblib )"
+		if use mysqlnd ; then
+	        my_conf+="
+			$(use_with mysql pdo-mysql mysqlnd)"
+		else
+	        my_conf+="
+			$(use_with mysql pdo-mysql /usr)"
+		fi
+	    my_conf+="
+		$(use_with postgres pdo-pgsql )
+		$(use_with sqlite3 pdo-sqlite /usr)
+		$(use_with odbc pdo-odbc unixODBC,/usr)"
+		if use oci8-instant-client ; then
+	        my_conf+="
+			$(use_with oci8-instant-client pdo-oci "instantclient,/usr,${OCI8IC_PKG}" )"
+		fi
+	fi
+
+	# readline/libedit support
+	my_conf+="
+	$(use_with readline readline )
+	$(use_with libedit libedit )"
+
+	# Session support
+	if use session ; then
+	    my_conf+="
+		$(use_with sharedmem mm )"
+	else
+	    my_conf+="
+		$(use_enable session session )"
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+
+	# Catch CFLAGS problems
+    # Fixes bug #14067.
+    # Changed order to run it in reverse for bug #32022 and #12021.
+    replace-cpu-flags "k6*" "i586"
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|cgi|embed|fpm)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_configure-v54.eblit b/dev-lang/php/files/eblits/src_configure-v54.eblit
new file mode 100644
index 0000000..9e6b295
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_configure-v54.eblit
@@ -0,0 +1,260 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_configure-v54.eblit,v 1.1 2011/12/18 09:00:26 olemarkus Exp $
+
+eblit-php-src_configure() {
+    addpredict /usr/share/snmp/mibs/.index
+
+	PHP_DESTDIR="/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	# for --with-libdir see bug #327025
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	#                             extension	      USE flag        shared
+	my_conf+="
+	$(use_enable bcmath bcmath )
+	$(use_with bzip2 bz2 )
+	$(use_enable calendar calendar )
+	$(use_enable ctype ctype )
+	$(use_with curl curl )
+	$(use_with curlwrappers curlwrappers )
+	$(use_enable xml dom )
+	$(use_with enchant enchant /usr)
+	$(use_enable exif exif )
+	$(use_enable fileinfo fileinfo )
+	$(use_enable filter filter )
+	$(use_enable ftp ftp )
+	$(use_with nls gettext )
+	$(use_with gmp gmp )
+	$(use_enable hash hash )
+	$(use_with mhash mhash )
+	$(use_with iconv iconv )
+	$(use_enable intl intl )
+	$(use_enable ipv6 ipv6 )
+	$(use_enable json json )
+	$(use_with kerberos kerberos /usr)
+	$(use_enable xml libxml )
+	$(use_enable unicode mbstring )
+	$(use_with crypt mcrypt )
+	$(use_with mssql mssql )
+	$(use_with unicode onig /usr)
+	$(use_with ssl openssl )
+	$(use_with ssl openssl-dir /usr)
+	$(use_enable pcntl pcntl )
+	$(use_enable phar phar )
+	$(use_enable pdo pdo )
+	$(use_with postgres pgsql )
+	$(use_enable posix posix )
+	$(use_with spell pspell )
+	$(use_with recode recode )
+	$(use_enable simplexml simplexml )
+	$(use_enable sharedmem shmop )
+	$(use_with snmp snmp )
+	$(use_enable soap soap )
+	$(use_enable sockets sockets )
+	$(use_with sqlite3 sqlite3 /usr)
+	$(use_with sybase-ct sybase-ct /usr)
+	$(use_enable sysvipc sysvmsg )
+	$(use_enable sysvipc sysvsem )
+	$(use_enable sysvipc sysvshm )
+	$(use_with tidy tidy )
+	$(use_enable tokenizer tokenizer )
+	$(use_enable wddx wddx )
+	$(use_enable xml xml )
+	$(use_enable xmlreader xmlreader )
+	$(use_enable xmlwriter xmlwriter )
+	$(use_with xmlrpc xmlrpc )
+	$(use_with xsl xsl )
+	$(use_enable zip zip )
+	$(use_with zlib zlib )
+	$(use_enable debug debug )"
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	my_conf+="
+	$(use_with cdb cdb )
+	$(use_with berkdb db4 )
+	$(use_enable flatfile flatfile )
+	$(use_with gdbm gdbm )
+	$(use_enable inifile inifile )
+	$(use_with qdbm qdbm )"
+
+	# Support for the GD graphics library
+	my_conf+="
+	$(use_with truetype freetype-dir /usr)
+	$(use_with truetype t1lib /usr)
+	$(use_enable cjk gd-jis-conv )
+	$(use_with gd jpeg-dir /usr)
+	$(use_with gd png-dir /usr)
+	$(use_with xpm xpm-dir /usr)"
+	# enable gd last, so configure can pick up the previous settings
+	my_conf+="
+	$(use_with gd gd )"
+
+	# IMAP support
+	if use imap ; then
+	    my_conf+="
+		$(use_with imap imap )
+		$(use_with ssl imap-ssl )"
+	fi
+
+	# Interbase/firebird support
+	
+	if use firebird ; then
+	    my_conf+="
+		$(use_with firebird interbase /usr)"
+	fi
+
+	# LDAP support
+	if use ldap ; then
+	    my_conf+="
+		$(use_with ldap ldap )
+		$(use_with ldap-sasl ldap-sasl )"
+	fi
+
+	# MySQL support
+	if use mysql ; then
+		if use mysqlnd ; then
+	        my_conf+="
+			$(use_with mysql mysql mysqlnd)"
+		else
+	        my_conf+="
+			$(use_with mysql mysql /usr)"
+		fi
+	    my_conf+="
+		$(use_with mysql mysql-sock /var/run/mysqld/mysqld.sock)"
+	fi
+
+	# MySQLi support
+	if use mysqlnd ; then
+	    my_conf+="
+		$(use_with mysqli mysqli mysqlnd)"
+	else
+	    my_conf+="
+		$(use_with mysqli mysqli /usr/bin/mysql_config)"
+	fi
+
+	# ODBC support
+	if use odbc ; then
+	    my_conf+="
+		$(use_with odbc unixODBC /usr)"
+	fi
+
+	if use iodbc ; then
+	    my_conf+="
+		$(use_with iodbc iodbc /usr)"
+	fi
+
+	# Oracle support
+	if use oci8-instant-client ; then
+		OCI8IC_PKG="$(best_version dev-db/oracle-instantclient-basic | \
+			sed -e 's|dev-db/oracle-instantclient-basic-||g' | \
+			sed -e 's|-r.*||g')"
+    
+	    my_conf+="
+		$(use_with oci8-instant-client oci8 "instantclient,/usr/lib/oracle/${OCI8IC_PKG}/client/lib")"
+	fi
+
+	# PDO support
+	if use pdo ; then
+	    my_conf+="
+		$(use_with mssql pdo-dblib )"
+		if use mysqlnd ; then
+	        my_conf+="
+			$(use_with mysql pdo-mysql mysqlnd)"
+		else
+	        my_conf+="
+			$(use_with mysql pdo-mysql /usr)"
+		fi
+	    my_conf+="
+		$(use_with postgres pdo-pgsql )
+		$(use_with sqlite3 pdo-sqlite /usr)
+		$(use_with odbc pdo-odbc unixODBC,/usr)"
+		if use oci8-instant-client ; then
+	        my_conf+="
+			$(use_with oci8-instant-client pdo-oci "instantclient,/usr,${OCI8IC_PKG}" )"
+		fi
+	fi
+
+	# readline/libedit support
+	my_conf+="
+	$(use_with readline readline )
+	$(use_with libedit libedit )"
+
+	# Session support
+	if use session ; then
+	    my_conf+="
+		$(use_with sharedmem mm )"
+	else
+	    my_conf+="
+		$(use_enable session session )"
+	fi
+
+	if use pic ; then
+		my_conf="${my_conf} --with-pic"
+	fi
+
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	my_conf="${my_conf} --with-pcre-regex=/usr --with-pcre-dir=/usr"
+
+	# Catch CFLAGS problems
+    # Fixes bug #14067.
+    # Changed order to run it in reverse for bug #32022 and #12021.
+    replace-cpu-flags "k6*" "i586"
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|cgi|embed|fpm)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
diff --git a/dev-lang/php/files/eblits/src_install-v1.eblit b/dev-lang/php/files/eblits/src_install-v1.eblit
new file mode 100644
index 0000000..225c8f4
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_install-v1.eblit
@@ -0,0 +1,160 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_install-v1.eblit,v 1.12 2010/10/27 10:33:18 olemarkus Exp $
+
+eblit-php-src_install() {
+	# see bug #324739 for what happens when we don't have that
+	addpredict /usr/share/snmp/mibs/.index
+
+	# grab the first SAPI that got built and install common files from there
+	local first_sapi=""
+	for sapi in $SAPIS ; do
+		if use $sapi ; then
+			first_sapi=$sapi
+			break
+		fi
+	done
+
+	# Makefile forgets to create this before trying to write to it...
+	dodir "${PHP_DESTDIR}/bin"
+
+	# Install php environment (without any sapis)
+	cd "${WORKDIR}/sapis-build/$first_sapi"
+	emake INSTALL_ROOT="${D}" \
+		install-build install-headers install-programs \
+		|| die "emake install failed"
+
+	local extension_dir="$("${D}/${PHP_DESTDIR}/bin/php-config" --extension-dir)"
+
+	# And install the modules to it
+	if use sharedext ; then
+		insinto "${extension_dir}"
+		doins "${WORKDIR}/sapis-build/${first_sapi}/modules/"*.so
+	fi
+
+	# Generate the USE file for PHP
+	phpconfutils_generate_usefile
+
+	# Create the directory where we'll put version-specific php scripts
+	keepdir /usr/share/php${PHP_MV}
+
+	local sapi="", file=""
+	local sapi_list=""
+
+	for sapi in ${SAPIS}; do
+		if use "${sapi}" ; then
+			einfo "Installing SAPI: ${sapi}"
+			cd "${WORKDIR}/sapis-build/${sapi}"
+			# needed each time, php_install_ini would reset it
+			into "${PHP_DESTDIR}"
+			file=$(find "${SAPI_DIR}/${sapi}/" -type f | head -n 1)
+
+			if [[ "${file: -3}" == ".so" ]]; then 
+				if [[ "${sapi}" == "apache2" ]]; then
+					insinto "${PHP_DESTDIR}/../apache2/modules/"
+					newins "${file}" "${file/*\/}"
+				else
+					dolib.so "${file}" || die "Unable to install ${sapi} sapi"
+				fi
+			else
+				dobin "${file}" || die "Unable to install ${sapi} sapi"
+			fi
+
+			php_install_ini "${sapi}"
+
+			# construct correct SAPI string for php-config
+			# thanks to ferringb for the bash voodoo
+			if [[ "${sapi}" == "apache2" ]]; then
+			    sapi_list="${sapi_list:+${sapi_list} }apache2handler"
+			else
+				sapi_list="${sapi_list:+${sapi_list} }${sapi}"
+			fi
+		fi
+	done
+
+	# Install env.d files
+	newenvd "${FILESDIR}/20php${PHP_MV}-envd" \
+		"20php${PHP_MV}"
+	sed -e "s|/lib/|/$(get_libdir)/|g" -i \
+		"${D}/etc/env.d/20php${PHP_MV}"
+
+	# set php-config variable correctly (bug #278439)
+	sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
+		"${D}/usr/$(get_libdir)/php5/bin/php-config"
+}
+
+php_install_ini() {
+	local phpsapi="${1}"
+
+	# work out where we are installing the ini file
+	php_set_ini_dir "${phpsapi}"
+
+	local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
+	cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
+
+	# default to allow_url_open=Off, bug 332763
+	sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i "${phpinisrc}"
+
+	# default to expose_php=Off, bug 300695
+	sed -e 's|^expose_php .*|expose_php = Off|g' -i "${phpinisrc}"
+
+	# default to /tmp for save_path, bug #282768
+	sed -e 's|^;session.save_path .*$|session.save_path = "/tmp"|g' -i "${phpinisrc}"
+
+	# Set the extension dir
+	sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
+
+	# Set the include path to point to where we want to find PEAR packages
+	sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php'${PHP_MV}':/usr/share/php"|' -i "${phpinisrc}"
+
+	dodir "${PHP_INI_DIR}"
+	insinto "${PHP_INI_DIR}"
+	newins "${phpinisrc}" "${PHP_INI_FILE}"
+
+	dodir "${PHP_EXT_INI_DIR}"
+	dodir "${PHP_EXT_INI_DIR_ACTIVE}"
+
+	# Install any extensions built as shared objects
+	if use sharedext ; then
+		insinto "${PHP_EXT_INI_DIR}"
+		for extension in "${D}/${extension_dir}/"*.so ; do
+			extension="${extension##*/}"
+			inifilename="${extension/.so/.ini}"
+			echo "extension=${extension}" > "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename"
+			doins "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename"
+			dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}"
+		done
+	fi
+
+	# SAPI-specific handling
+	if [[ "${sapi}" == "apache2" ]] ; then
+		if use concurrentmodphp ; then
+			einfo "Installing Apache2 config file 70_mod_php${PHP_MV}_concurr.conf"
+			insinto "${APACHE_MODULES_CONFDIR}"
+			newins "${FILESDIR}/70_mod_php${PHP_MV}_concurr.conf-apache2" \
+				"70_mod_php${PHP_MV}_concurr.conf"
+
+			# Put the ld version script in the right place so
+			# it's always accessible
+			insinto "/var/lib/php-pkg/${CATEGORY}/${PN}-${PVR}/"
+			doins "${FILESDIR}/php${PHP_MV}-ldvs"
+		else
+			einfo "Installing Apache2 config 70_mod_php${PHP_MV}.conf"
+			insinto ${APACHE_MODULES_CONFDIR}
+			newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
+				"70_mod_php${PHP_MV}.conf"
+		fi
+	fi
+
+	if [[ "${sapi}" == "fpm" ]] ; then
+		einfo "Installing FPM CGI config file php-fpm.conf"
+		epatch "${FILESDIR}/php-fpm-gentooified.patch"
+		insinto ${PHP_INI_DIR}
+		doins "${WORKDIR}/sapis-build/fpm/sapi/fpm/php-fpm.conf"
+		dodir "/etc/init.d"
+		insinto "/etc/init.d"
+		newins  "${FILESDIR}/php-fpm.init" "php-fpm"
+		fperms 755 "/etc/init.d/php-fpm"
+		dosym "${PHP_DESTDIR}/bin/php-fpm" "/usr/bin/php-fpm"
+	fi
+}
diff --git a/dev-lang/php/files/eblits/src_install-v2.eblit b/dev-lang/php/files/eblits/src_install-v2.eblit
new file mode 100644
index 0000000..b0dd1ae
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_install-v2.eblit
@@ -0,0 +1,165 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_install-v2.eblit,v 1.14 2011/12/16 09:02:43 olemarkus Exp $
+
+eblit-php-src_install() {
+	# see bug #324739 for what happens when we don't have that
+	addpredict /usr/share/snmp/mibs/.index
+
+	# grab the first SAPI that got built and install common files from there
+	local first_sapi=""
+	for sapi in $SAPIS ; do
+		if use $sapi ; then
+			first_sapi=$sapi
+			break
+		fi
+	done
+
+	# Makefile forgets to create this before trying to write to it...
+	dodir "${PHP_DESTDIR}/bin"
+
+	# Install php environment (without any sapis)
+	cd "${WORKDIR}/sapis-build/$first_sapi"
+	emake INSTALL_ROOT="${D}" \
+		install-build install-headers install-programs \
+		|| die "emake install failed"
+
+	local extension_dir="$("${D}/${PHP_DESTDIR}/bin/php-config" --extension-dir)"
+
+	# And install the modules to it
+	if use sharedext ; then
+		insinto "${extension_dir}"
+		doins "${WORKDIR}/sapis-build/${first_sapi}/modules/"*.so
+	fi
+
+	# Create the directory where we'll put version-specific php scripts
+	keepdir /usr/share/php${PHP_MV}
+
+	local sapi="", file=""
+	local sapi_list=""
+
+	for sapi in ${SAPIS}; do
+		if use "${sapi}" ; then
+			einfo "Installing SAPI: ${sapi}"
+			cd "${WORKDIR}/sapis-build/${sapi}"
+			# needed each time, php_install_ini would reset it
+			into "${PHP_DESTDIR}"
+			file=$(find "${SAPI_DIR}/${sapi}/" -type f | head -n 1)
+
+			if [[ "${file: -3}" == ".so" ]]; then 
+				if [[ "${sapi}" == "apache2" ]]; then
+					insinto "${PHP_DESTDIR}/apache2/"
+					newins "${file}" "${file/*\/}"
+                    keepdir "/usr/$(get_libdir)/apache2/modules"
+				else
+					dolib.so "${file}" || die "Unable to install ${sapi} sapi"
+				fi
+			else
+				dobin "${file}" || die "Unable to install ${sapi} sapi"
+			fi
+
+			php_install_ini "${sapi}"
+
+			# construct correct SAPI string for php-config
+			# thanks to ferringb for the bash voodoo
+			if [[ "${sapi}" == "apache2" ]]; then
+			    sapi_list="${sapi_list:+${sapi_list} }apache2handler"
+			else
+				sapi_list="${sapi_list:+${sapi_list} }${sapi}"
+			fi
+		fi
+	done
+
+	# Install env.d files
+	newenvd "${FILESDIR}/20php5-envd" \
+		"20php${SLOT}"
+	sed -e "s|/lib/|/$(get_libdir)/|g" -i \
+		"${D}/etc/env.d/20php${SLOT}"
+	sed -e "s|php5|php${SLOT}|g" -i \
+		"${D}/etc/env.d/20php${SLOT}"
+
+	# set php-config variable correctly (bug #278439)
+	sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
+		"${D}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
+}
+
+php_install_ini() {
+	local phpsapi="${1}"
+
+	# work out where we are installing the ini file
+	php_set_ini_dir "${phpsapi}"
+
+	local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
+	cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
+
+	# default to allow_url_open=Off, bug 332763
+	sed -e 's|^allow_url_fopen .*|allow_url_fopen = Off|g' -i "${phpinisrc}"
+
+	# default to expose_php=Off, bug 300695
+	sed -e 's|^expose_php .*|expose_php = Off|g' -i "${phpinisrc}"
+
+	# default to /tmp for save_path, bug #282768
+	sed -e 's|^;session.save_path .*$|session.save_path = "/tmp"|g' -i "${phpinisrc}"
+
+	# Set the extension dir
+	sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
+
+	# Set the include path to point to where we want to find PEAR packages
+	sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php'${PHP_MV}':/usr/share/php"|' -i "${phpinisrc}"
+
+	dodir "${PHP_INI_DIR}"
+	insinto "${PHP_INI_DIR}"
+	newins "${phpinisrc}" "${PHP_INI_FILE}"
+
+	elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR}"
+	elog
+
+	dodir "${PHP_EXT_INI_DIR}"
+	dodir "${PHP_EXT_INI_DIR_ACTIVE}"
+
+	# Install any extensions built as shared objects
+	if use sharedext ; then
+		insinto "${PHP_EXT_INI_DIR}"
+		for extension in "${D}/${extension_dir}/"*.so ; do
+			extension="${extension##*/}"
+			inifilename="${extension/.so/.ini}"
+			echo "extension=${extension}" > "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename"
+			doins "${WORKDIR}/sapis-build/${phpsapi}/modules/$inifilename"
+			dosym "${PHP_EXT_INI_DIR}/${inifilename}" "${PHP_EXT_INI_DIR_ACTIVE}/${inifilename}"
+		done
+	fi
+
+	# SAPI-specific handling
+	if [[ "${sapi}" == "apache2" ]] ; then
+			insinto "${APACHE_MODULES_CONFDIR}"
+			newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
+				"70_mod_php${PHP_MV}.conf"
+	fi
+
+	if [[ "${sapi}" == "fpm" ]] ; then
+        [[ -z ${PHP_FPM_INIT_VER} ]] && PHP_FPM_INIT_VER=3
+        [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
+		einfo "Installing FPM CGI config file php-fpm.conf"
+		insinto ${PHP_INI_DIR}
+		newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
+		dodir "/etc/init.d"
+		insinto "/etc/init.d"
+		newinitd "${FILESDIR}/php-fpm-r${PHP_FPM_INIT_VER}.init" "php-fpm"
+		#dosym "${PHP_DESTDIR}/bin/php-fpm" "/usr/bin/php-fpm"
+		
+		# Remove bogus /etc/php-fpm.conf.default (bug 359906)
+		[[ -f "${D}/etc/php-fpm.conf.default" ]] && rm "${D}/etc/php-fpm.conf.default"
+	fi
+
+  # Install PHP ini files into /usr/share/php
+	if [[ ${SLOT} == '5.2' ]]; then
+		newdoc php.ini-dist php.ini-development
+		newdoc php.ini-recommended php.ini-production
+	fi
+
+	if [[ ${SLOT} == '5.3' ]]; then
+		dodoc php.ini-development
+		dodoc php.ini-production
+	fi
+
+}
diff --git a/dev-lang/php/files/eblits/src_install-v3.eblit b/dev-lang/php/files/eblits/src_install-v3.eblit
new file mode 100644
index 0000000..4c3ba24
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_install-v3.eblit
@@ -0,0 +1,160 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_install-v3.eblit,v 1.5 2011/11/08 18:14:08 olemarkus Exp $
+
+eblit-php-src_install() {
+	# see bug #324739 for what happens when we don't have that
+	addpredict /usr/share/snmp/mibs/.index
+
+	# grab the first SAPI that got built and install common files from there
+	local first_sapi=""
+	for sapi in $SAPIS ; do
+		if use $sapi ; then
+			first_sapi=$sapi
+			break
+		fi
+	done
+
+	# Makefile forgets to create this before trying to write to it...
+	dodir "${PHP_DESTDIR}/bin"
+
+	# Install php environment (without any sapis)
+	cd "${WORKDIR}/sapis-build/$first_sapi"
+	emake INSTALL_ROOT="${D}" \
+		install-build install-headers install-programs \
+		|| die "emake install failed"
+
+	local extension_dir="$("${D}/${PHP_DESTDIR}/bin/php-config" --extension-dir)"
+
+	# Create the directory where we'll put version-specific php scripts
+	keepdir /usr/share/php${PHP_MV}
+
+	local sapi="", file=""
+	local sapi_list=""
+
+	for sapi in ${SAPIS}; do
+		if use "${sapi}" ; then
+			einfo "Installing SAPI: ${sapi}"
+			cd "${WORKDIR}/sapis-build/${sapi}"
+
+			if [[ "${sapi}" == "apache2" ]] ; then
+				# We're specifically not using emake install-sapi as libtool
+				# may cause unnecessary relink failures (see bug #351266)
+				insinto "${PHP_DESTDIR}/apache2/"
+				newins ".libs/libphp5.so" "libphp${PHP_MV}.so"
+				keepdir "/usr/$(get_libdir)/apache2/modules"
+			else
+				# needed each time, php_install_ini would reset it
+				into "${PHP_DESTDIR}"
+			    case "$sapi" in
+					cli)
+						source="sapi/cli/php"
+						;;
+					cgi)
+						source="sapi/cgi/php-cgi"
+						;;
+					fpm)
+						source="sapi/fpm/php-fpm"
+						;;
+					embed)
+						source="libs/libphp${PHP_MV}.so"
+						;;
+					*)
+						die "unhandled sapi in src_install"
+						;;
+				esac
+
+				if [[ "${source: -3}" == ".so" ]]; then 
+					dolib.so "${source}" || die "Unable to install ${sapi} sapi"
+				else
+					dobin "${source}" || die "Unable to install ${sapi} sapi"
+				fi
+			fi
+
+			php_install_ini "${sapi}"
+
+			# construct correct SAPI string for php-config
+			# thanks to ferringb for the bash voodoo
+			if [[ "${sapi}" == "apache2" ]]; then
+				sapi_list="${sapi_list:+${sapi_list} }apache2handler"
+			else
+				sapi_list="${sapi_list:+${sapi_list} }${sapi}"
+			fi
+		fi
+	done
+
+	# Install env.d files
+	newenvd "${FILESDIR}/20php5-envd" \
+		"20php${SLOT}"
+	sed -e "s|/lib/|/$(get_libdir)/|g" -i \
+		"${D}/etc/env.d/20php${SLOT}"
+	sed -e "s|php5|php${SLOT}|g" -i \
+		"${D}/etc/env.d/20php${SLOT}"
+
+	# set php-config variable correctly (bug #278439)
+	sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
+		"${D}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
+}
+
+php_install_ini() {
+	local phpsapi="${1}"
+
+	# work out where we are installing the ini file
+	php_set_ini_dir "${phpsapi}"
+
+	local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
+	cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
+
+	# default to /tmp for save_path, bug #282768
+	sed -e 's|^;session.save_path .*$|session.save_path = "/tmp"|g' -i "${phpinisrc}"
+
+	# Set the extension dir
+	sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
+
+	# Set the include path to point to where we want to find PEAR packages
+	sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:/usr/share/php'${PHP_MV}':/usr/share/php"|' -i "${phpinisrc}"
+
+	dodir "${PHP_INI_DIR}"
+	insinto "${PHP_INI_DIR}"
+	newins "${phpinisrc}" "${PHP_INI_FILE}"
+
+	elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR}"
+	elog
+
+	dodir "${PHP_EXT_INI_DIR}"
+	dodir "${PHP_EXT_INI_DIR_ACTIVE}"
+
+	# SAPI-specific handling
+	if [[ "${sapi}" == "apache2" ]] ; then
+			insinto "${APACHE_MODULES_CONFDIR}"
+			newins "${FILESDIR}/70_mod_php${PHP_MV}.conf-apache2" \
+				"70_mod_php${PHP_MV}.conf"
+	fi
+
+	if [[ "${sapi}" == "fpm" ]] ; then
+        [[ -z ${PHP_FPM_INIT_VER} ]] && PHP_FPM_INIT_VER=3
+        [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
+		einfo "Installing FPM CGI config file php-fpm.conf"
+		insinto ${PHP_INI_DIR}
+		newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
+		dodir "/etc/init.d"
+		insinto "/etc/init.d"
+		newinitd "${FILESDIR}/php-fpm-r${PHP_FPM_INIT_VER}.init" "php-fpm"
+		#dosym "${PHP_DESTDIR}/bin/php-fpm" "/usr/bin/php-fpm"
+		
+		# Remove bogus /etc/php-fpm.conf.default (bug 359906)
+		[[ -f "${D}/etc/php-fpm.conf.default" ]] && rm "${D}/etc/php-fpm.conf.default"
+	fi
+
+  # Install PHP ini files into /usr/share/php
+	if [[ ${SLOT} == '5.2' ]]; then
+		newdoc php.ini-dist php.ini-development
+		newdoc php.ini-recommended php.ini-production
+	fi
+
+	if [[ ${SLOT} == '5.3' ]]; then
+		dodoc php.ini-development
+		dodoc php.ini-production
+	fi
+
+}
diff --git a/dev-lang/php/files/eblits/src_prepare-v1.eblit b/dev-lang/php/files/eblits/src_prepare-v1.eblit
new file mode 100644
index 0000000..d6856b8
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_prepare-v1.eblit
@@ -0,0 +1,70 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v1.eblit,v 1.3 2010/06/01 16:17:05 mabi Exp $
+
+eblit-php-src_prepare() {
+	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
+	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
+	# there is no easy way to circumvent that, all php calls during
+	# install use -n, so no php.ini file will be used.
+	# As such, this is the easiest way to get around
+	addpredict /session_mm_cli250.sem
+	addpredict /session_mm_cli0.sem
+
+	# Concurrent PHP Apache2 modules support
+	use apache2 && use concurrentmodphp && \
+		epatch "${WORKDIR}/${PV}/opt/concurrent_apache_modules.patch"
+
+	# kolab support (support for imap annotations)
+	use kolab && epatch "${WORKDIR}/${PV}/opt/imap-kolab-annotations.patch"
+
+	# Change PHP branding
+	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \
+		-i configure.in || die "Unable to change PHP branding"
+
+	# Apply generic PHP patches
+	EPATCH_SOURCE="${WORKDIR}/${PV}/generic" EPATCH_SUFFIX="patch" \
+		EPATCH_FORCE="yes" \
+		EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
+
+	# Patch PHP to show Gentoo as the server platform
+	sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
+		-i configure.in || die "Failed to fix server platform name"
+
+	# Prevent PHP from activating the Apache config,
+	# as we will do that ourselves
+	sed -i \
+		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
+
+	# Patch PHP to support heimdal instead of mit-krb5
+	if has_version "app-crypt/heimdal" ; then
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal libname"
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal crypt library reference"
+	fi
+
+	# Suhosin support
+	if use suhosin ; then
+		epatch "${WORKDIR}/${SUHOSIN_PATCH}"
+	fi
+
+	# rebuild the whole autotools stuff as we are heavily patching it
+	# (suhosin, fastbuild, ...)
+
+	# eaclocal doesn't accept --force, so we try to force re-generation
+	# this way
+	rm aclocal.m4
+
+	# work around divert() issues with newer autoconf, bug #281697
+	if has_version '>=sys-devel/autoconf-2.64' ; then
+		sed -i -r \
+			-e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
+			$(grep -l divert $(find . -name '*.m4') configure.in) || die
+	fi
+	eautoreconf --force -W no-cross
+}
+
+
diff --git a/dev-lang/php/files/eblits/src_prepare-v2.eblit b/dev-lang/php/files/eblits/src_prepare-v2.eblit
new file mode 100644
index 0000000..b6bd72e
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_prepare-v2.eblit
@@ -0,0 +1,71 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v2.eblit,v 1.3 2011/01/05 11:23:16 mabi Exp $
+
+eblit-php-src_prepare() {
+	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
+	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
+	# there is no easy way to circumvent that, all php calls during
+	# install use -n, so no php.ini file will be used.
+	# As such, this is the easiest way to get around
+	addpredict /session_mm_cli250.sem
+	addpredict /session_mm_cli0.sem
+
+	# kolab support (support for imap annotations)
+	use kolab && epatch "${WORKDIR}/${PV}/opt/imap-kolab-annotations.patch"
+
+	# Change PHP branding
+	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \
+		-i configure.in || die "Unable to change PHP branding"
+
+	# Apply generic PHP patches
+	EPATCH_SOURCE="${WORKDIR}/${PV}/generic" EPATCH_SUFFIX="patch" \
+		EPATCH_FORCE="yes" \
+		EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
+
+	# Patch PHP to show Gentoo as the server platform
+	sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
+		-i configure.in || die "Failed to fix server platform name"
+
+	# Prevent PHP from activating the Apache config,
+	# as we will do that ourselves
+	sed -i \
+		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
+
+	# Patch PHP to support heimdal instead of mit-krb5
+	if has_version "app-crypt/heimdal" ; then
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal libname"
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal crypt library reference"
+	fi
+
+	# Suhosin support
+	if [[ -n $SUHOSIN_VERSION ]] ; then
+		if use suhosin ; then
+			epatch "${WORKDIR}/${SUHOSIN_PATCH}"
+		fi
+	else
+		ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
+	fi
+
+
+	# rebuild the whole autotools stuff as we are heavily patching it
+	# (suhosin, fastbuild, ...)
+
+	# eaclocal doesn't accept --force, so we try to force re-generation
+	# this way
+	rm aclocal.m4
+
+	# work around divert() issues with newer autoconf, bug #281697
+	if has_version '>=sys-devel/autoconf-2.64' ; then
+		sed -i -r \
+			-e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
+			$(grep -l divert $(find . -name '*.m4') configure.in) || die
+	fi
+	eautoreconf --force -W no-cross
+}
+
+
diff --git a/dev-lang/php/files/eblits/src_prepare-v3.eblit b/dev-lang/php/files/eblits/src_prepare-v3.eblit
new file mode 100644
index 0000000..7e270f9
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_prepare-v3.eblit
@@ -0,0 +1,73 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v3.eblit,v 1.1 2011/03/13 09:48:06 olemarkus Exp $
+
+eblit-php-src_prepare() {
+	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
+	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
+	# there is no easy way to circumvent that, all php calls during
+	# install use -n, so no php.ini file will be used.
+	# As such, this is the easiest way to get around
+	addpredict /session_mm_cli250.sem
+	addpredict /session_mm_cli0.sem
+
+	# kolab support (support for imap annotations)
+	use kolab && epatch "${WORKDIR}/${PV}/opt/imap-kolab-annotations.patch"
+
+	# Change PHP branding
+	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-pl${PR/r/}-gentoo\2|g" \
+		-i configure.in || die "Unable to change PHP branding"
+
+	# Apply generic PHP patches
+	EPATCH_SOURCE="${WORKDIR}/${PV}/generic" EPATCH_SUFFIX="patch" \
+		EPATCH_FORCE="yes" \
+		EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
+
+	# Patch PHP to show Gentoo as the server platform
+	sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
+		-i configure.in || die "Failed to fix server platform name"
+
+	# Prevent PHP from activating the Apache config,
+	# as we will do that ourselves
+	sed -i \
+		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
+
+	# Patch PHP to support heimdal instead of mit-krb5
+	if has_version "app-crypt/heimdal" ; then
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal libname"
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal crypt library reference"
+	fi
+
+	# Suhosin support
+	if [[ -n $SUHOSIN_VERSION ]] ; then
+		if use suhosin ; then
+			epatch "${WORKDIR}/${SUHOSIN_PATCH}"
+		fi
+	else
+		ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
+	fi
+
+	#Add user patches #357637
+	epatch_user
+
+	# rebuild the whole autotools stuff as we are heavily patching it
+	# (suhosin, fastbuild, ...)
+
+	# eaclocal doesn't accept --force, so we try to force re-generation
+	# this way
+	rm aclocal.m4
+
+	# work around divert() issues with newer autoconf, bug #281697
+	if has_version '>=sys-devel/autoconf-2.64' ; then
+		sed -i -r \
+			-e 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
+			$(grep -l divert $(find . -name '*.m4') configure.in) || die
+	fi
+	eautoreconf --force -W no-cross
+}
+
+
diff --git a/dev-lang/php/files/eblits/src_prepare-v4.eblit b/dev-lang/php/files/eblits/src_prepare-v4.eblit
new file mode 100644
index 0000000..cab740f
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_prepare-v4.eblit
@@ -0,0 +1,62 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_prepare-v4.eblit,v 1.1 2011/06/29 06:38:38 olemarkus Exp $
+
+eblit-php-src_prepare() {
+	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
+	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
+	# there is no easy way to circumvent that, all php calls during
+	# install use -n, so no php.ini file will be used.
+	# As such, this is the easiest way to get around
+	addpredict /session_mm_cli250.sem
+	addpredict /session_mm_cli0.sem
+
+	# kolab support (support for imap annotations)
+	use kolab && epatch "${WORKDIR}/patches/opt/imap-kolab-annotations.patch"
+
+	# Change PHP branding
+	# Get the alpha/beta/rc version
+	local ver=$(get_version_component_range 4)
+	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1${PHP_EXTRA_BRANDING}-${ver}-pl${PR/r/}-gentoo\2|g" \
+		-i configure.in || die "Unable to change PHP branding"
+
+	# Apply generic PHP patches
+		EPATCH_SOURCE="${WORKDIR}/patches/generic" EPATCH_SUFFIX="patch" \
+		EPATCH_FORCE="yes" \
+		EPATCH_MULTI_MSG="Applying generic patches and fixes from upstream..." epatch
+
+	# Patch PHP to show Gentoo as the server platform
+	sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
+		-i configure.in || die "Failed to fix server platform name"
+
+	# Prevent PHP from activating the Apache config,
+	# as we will do that ourselves
+	sed -i \
+		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
+	configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
+
+	# Patch PHP to support heimdal instead of mit-krb5
+	if has_version "app-crypt/heimdal" ; then
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal libname"
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal crypt library reference"
+	fi
+
+	# Suhosin support
+	if [[ -n $SUHOSIN_VERSION ]] ; then
+		if use suhosin ; then
+			epatch "${WORKDIR}/${SUHOSIN_PATCH}"
+		fi
+	else
+		ewarn "Please note that this version of PHP does not yet come with a suhosin patch"
+	fi
+
+	#Add user patches #357637
+	epatch_user
+	
+	#force rebuilding aclocal.m4
+	rm aclocal.m4
+	eautoreconf
+}
diff --git a/dev-lang/php/files/eblits/src_test-v1.eblit b/dev-lang/php/files/eblits/src_test-v1.eblit
new file mode 100644
index 0000000..95ebc7d
--- /dev/null
+++ b/dev-lang/php/files/eblits/src_test-v1.eblit
@@ -0,0 +1,54 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/files/eblits/src_test-v1.eblit,v 1.2 2010/08/09 10:47:57 mabi Exp $
+
+eblit-php-src_test() {
+	vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+	if [[ ! -x "${WORKDIR}/sapis/cli/php" ]] ; then
+		ewarn "Test phase requires USE=cli, skipping"
+		return
+	else
+		export TEST_PHP_EXECUTABLE="${WORKDIR}/sapis/cli/php"
+	fi
+
+	if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
+		export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
+	fi
+	
+	
+	REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n  -d "session.save_path=${T}" \
+		"${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
+
+	for name in ${EXPECTED_TEST_FAILURES}; do
+		mv "${name}.out" "${name}.out.orig" 2>/dev/null
+	done
+
+	local failed="$(find -name '*.out')"
+	if [[ ${failed} != "" ]] ; then
+		ewarn "The following test cases failed unexpectedly:"
+		for name in ${failed}; do
+			ewarn "  ${name/.out/}"
+		done
+	else
+		einfo "No unexpected test failures, all fine"
+	fi
+
+	if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
+		local passed=""
+		for name in ${EXPECTED_TEST_FAILURES}; do
+			[[ -f "${name}.diff" ]] && continue
+			passed="${passed} ${name}"
+		done
+		if [[ ${passed} != "" ]] ; then
+			einfo "The following test cases passed unexpectedly:"
+			for name in ${passed}; do
+				ewarn "  ${passed}"
+			done
+		else
+			einfo "None of the known-to-fail tests passed, all fine"
+		fi
+	fi
+}
+
+
diff --git a/dev-lang/php/files/php-fpm-r4.init b/dev-lang/php/files/php-fpm-r4.init
new file mode 100755
index 0000000..a186d83
--- /dev/null
+++ b/dev-lang/php/files/php-fpm-r4.init
@@ -0,0 +1,47 @@
+#!/sbin/runscript
+
+set_phpvars() {
+	PHPSLOT=${SVCNAME#php-fpm-}
+	[ ${PHPSLOT} = 'php-fpm' ] && PHPSLOT="$(eselect php show fpm)"
+
+	PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
+	PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"
+}
+
+extra_commands="depend"
+extra_started_commands="reload"
+
+depend() {
+	need net
+	use apache2 lighttpd nginx
+}
+
+start() {
+        ebegin "Starting PHP FastCGI Process Manager"
+	set_phpvars
+        start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \
+            /usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}"
+        local i=0
+        local timeout=5
+        while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do
+            sleep 1
+            i=$(($i + 1))
+        done
+        
+        [ $timeout -gt $i ]
+        eend $?
+}
+
+stop() {
+        ebegin "Stopping PHP FastCGI Process Manager"
+	set_phpvars
+        start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID}
+        eend $?
+}
+
+reload() {
+    ebegin "Reloading PHP FastCGI Process Manager"
+    set_phpvars
+    [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
+    eend $?
+}
diff --git a/dev-lang/php/files/php-fpm.conf b/dev-lang/php/files/php-fpm.conf
new file mode 100644
index 0000000..ddef717
--- /dev/null
+++ b/dev-lang/php/files/php-fpm.conf
@@ -0,0 +1,310 @@
+;;;;;;;;;;;;;;;;;;;;;
+; FPM Configuration ;
+;;;;;;;;;;;;;;;;;;;;;
+
+; All relative paths in this configuration file are relative to PHP's install
+; prefix (/usr/lib/php5.3). This prefix can be dynamicaly changed by using the
+; '-p' argument from the command line.
+
+; Include one or more files. If glob(3) exists, it is used to include a bunch of
+; files from a glob(3) pattern. This directive can be used everywhere in the
+; file.
+; Relative path can also be used. They will be prefixed by:
+;  - the global prefix if it's been set (-p arguement)
+;  - /usr/lib/php5.3 otherwise
+;include=/etc/php/fpm-php5.3/fpm.d/*.conf
+
+;;;;;;;;;;;;;;;;;;
+; Global Options ;
+;;;;;;;;;;;;;;;;;;
+
+[global]
+; Pid file
+; Note: the default prefix is /var/lib
+; Default Value: none
+; Note: The Gentoo init script expects the pid path
+; to be set to /var/run/php-fpm.pid
+pid = /var/run/php-fpm.pid
+
+; Error log file
+; Note: the default prefix is /var/lib
+; Default Value: log/php-fpm.log
+error_log = /var/log/php-fpm.log
+
+; Log level
+; Possible Values: alert, error, warning, notice, debug
+; Default Value: notice
+;log_level = notice
+
+; If this number of child processes exit with SIGSEGV or SIGBUS within the time
+; interval set by emergency_restart_interval then FPM will restart. A value
+; of '0' means 'Off'.
+; Default Value: 0
+;emergency_restart_threshold = 0
+
+; Interval of time used by emergency_restart_interval to determine when 
+; a graceful restart will be initiated.  This can be useful to work around
+; accidental corruptions in an accelerator's shared memory.
+; Available Units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;emergency_restart_interval = 0
+
+; Time limit for child processes to wait for a reaction on signals from master.
+; Available units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;process_control_timeout = 0
+
+; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
+; Default Value: yes
+;daemonize = yes
+
+;;;;;;;;;;;;;;;;;;;;
+; Pool Definitions ; 
+;;;;;;;;;;;;;;;;;;;;
+
+; Multiple pools of child processes may be started with different listening
+; ports and different management options.  The name of the pool will be
+; used in logs and stats. There is no limitation on the number of pools which
+; FPM can handle. Your system will tell you anyway :)
+
+; Start a new pool named 'www'.
+; the variable $pool can we used in any directive and will be replaced by the
+; pool name ('www' here)
+[www]
+
+; Per pool prefix
+; It only applies on the following directives:
+; - 'slowlog'
+; - 'listen' (unixsocket)
+; - 'chroot'
+; - 'chdir'
+; - 'php_values'
+; - 'php_admin_values'
+; When not set, the global prefix (or /usr/lib/php5.3) applies instead.
+; Note: This directive can also be relative to the global prefix.
+; Default Value: none
+;prefix = /path/to/pools/$pool
+
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
+;                            a specific port;
+;   'port'                 - to listen on a TCP socket to all addresses on a
+;                            specific port;
+;   '/path/to/unix/socket' - to listen on a unix socket.
+; Note: This value is mandatory.
+listen = 127.0.0.1:9000
+
+; Set listen(2) backlog. A value of '-1' means unlimited.
+; Default Value: 128 (-1 on FreeBSD and OpenBSD)
+;listen.backlog = -1
+ 
+; List of ipv4 addresses of FastCGI clients which are allowed to connect.
+; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
+; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
+; must be separated by a comma. If this value is left blank, connections will be
+; accepted from any ip address.
+; Default Value: any
+;listen.allowed_clients = 127.0.0.1
+
+; Set permissions for unix socket, if one is used. In Linux, read/write
+; permissions must be set in order to allow connections from a web server. Many
+; BSD-derived systems allow connections regardless of permissions. 
+; Default Values: user and group are set as the running user
+;                 mode is set to 0666
+;listen.owner = nobody
+;listen.group = nobody
+;listen.mode = 0666
+
+; Unix user/group of processes
+; Note: The user is mandatory. If the group is not set, the default user's group
+;       will be used.
+user = nobody
+group = nobody
+
+; Choose how the process manager will control the number of child processes.
+; Possible Values:
+;   static  - a fixed number (pm.max_children) of child processes;
+;   dynamic - the number of child processes are set dynamically based on the
+;             following directives:
+;             pm.max_children      - the maximum number of children that can
+;                                    be alive at the same time.
+;             pm.start_servers     - the number of children created on startup.
+;             pm.min_spare_servers - the minimum number of children in 'idle'
+;                                    state (waiting to process). If the number
+;                                    of 'idle' processes is less than this
+;                                    number then some children will be created.
+;             pm.max_spare_servers - the maximum number of children in 'idle'
+;                                    state (waiting to process). If the number
+;                                    of 'idle' processes is greater than this
+;                                    number then some children will be killed.
+; Note: This value is mandatory.
+pm = dynamic
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes to be created when pm is set to 'dynamic'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
+; CGI.
+; Note: Used when pm is set to either 'static' or 'dynamic'
+; Note: This value is mandatory.
+pm.max_children = 50
+
+; The number of child processes created on startup.
+; Note: Used only when pm is set to 'dynamic'
+; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
+;pm.start_servers = 20
+
+; The desired minimum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.min_spare_servers = 5
+
+; The desired maximum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.max_spare_servers = 35
+ 
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+;pm.max_requests = 500
+
+; The URI to view the FPM status page. If this value is not set, no URI will be
+; recognized as a status page. By default, the status page shows the following
+; information:
+;   accepted conn        - the number of request accepted by the pool;
+;   pool                 - the name of the pool;
+;   process manager      - static or dynamic;
+;   idle processes       - the number of idle processes;
+;   active processes     - the number of active processes;
+;   total processes      - the number of idle + active processes.
+;   max children reached - number of times, the process limit has been reached,
+;                          when pm tries to start more children (works only for
+;                          pm 'dynamic')
+; The values of 'idle processes', 'active processes' and 'total processes' are
+; updated each second. The value of 'accepted conn' is updated in real time.
+; Example output:
+;   accepted conn:        12073
+;   pool:                 www
+;   process manager:      static
+;   idle processes:       35
+;   active processes:     65
+;   total processes:      100
+;   max children reached: 1
+; By default the status page output is formatted as text/plain. Passing either
+; 'html' or 'json' as a query string will return the corresponding output
+; syntax. Example:
+;   http://www.foo.bar/status
+;   http://www.foo.bar/status?json
+;   http://www.foo.bar/status?html
+; Note: The value must start with a leading slash (/). The value can be
+;       anything, but it may not be a good idea to use the .php extension or it
+;       may conflict with a real PHP file.
+; Default Value: not set 
+;pm.status_path = /status
+ 
+; The ping URI to call the monitoring page of FPM. If this value is not set, no
+; URI will be recognized as a ping page. This could be used to test from outside
+; that FPM is alive and responding, or to
+; - create a graph of FPM availability (rrd or such);
+; - remove a server from a group if it is not responding (load balancing);
+; - trigger alerts for the operating team (24/7).
+; Note: The value must start with a leading slash (/). The value can be
+;       anything, but it may not be a good idea to use the .php extension or it
+;       may conflict with a real PHP file.
+; Default Value: not set
+;ping.path = /ping
+
+; This directive may be used to customize the response of a ping request. The
+; response is formatted as text/plain with a 200 response code.
+; Default Value: pong
+;ping.response = pong
+ 
+; The timeout for serving a single request after which the worker process will
+; be killed. This option should be used when the 'max_execution_time' ini option
+; does not stop script execution for some reason. A value of '0' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_terminate_timeout = 0
+ 
+; The timeout for serving a single request after which a PHP backtrace will be
+; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_slowlog_timeout = 0
+ 
+; The log file for slow requests
+; Default Value: not set
+; Note: slowlog is mandatory if request_slowlog_timeout is set
+;slowlog = /var/log/php-fpm-$pool.log.slow
+ 
+; Set open file descriptor rlimit.
+; Default Value: system defined value
+;rlimit_files = 1024
+ 
+; Set max core size rlimit.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+ 
+; Chroot to this directory at the start. This value must be defined as an
+; absolute path. When this value is not set, chroot is not used.
+; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
+; of its subdirectories. If the pool prefix is not set, the global prefix
+; will be used instead.
+; Note: chrooting is a great security feature and should be used whenever 
+;       possible. However, all PHP paths will be relative to the chroot
+;       (error_log, sessions.save_path, ...).
+; Default Value: not set
+;chroot = 
+ 
+; Chdir to this directory at the start.
+; Note: relative path can be used.
+; Default Value: current directory or / when chroot
+;chdir = /var/www
+ 
+; Redirect worker stdout and stderr into main error log. If not set, stdout and
+; stderr will be redirected to /dev/null according to FastCGI specs.
+; Note: on highloaded environement, this can cause some delay in the page
+; process time (several ms).
+; Default Value: no
+;catch_workers_output = yes
+ 
+; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
+; the current environment.
+; Default Value: clean env
+;env[HOSTNAME] = $HOSTNAME
+;env[PATH] = /usr/local/bin:/usr/bin:/bin
+;env[TMP] = /tmp
+;env[TMPDIR] = /tmp
+;env[TEMP] = /tmp
+
+; Additional php.ini defines, specific to this pool of workers. These settings
+; overwrite the values previously defined in the php.ini. The directives are the
+; same as the PHP SAPI:
+;   php_value/php_flag             - you can set classic ini defines which can
+;                                    be overwritten from PHP call 'ini_set'. 
+;   php_admin_value/php_admin_flag - these directives won't be overwritten by
+;                                     PHP call 'ini_set'
+; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
+
+; Defining 'extension' will load the corresponding shared extension from
+; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
+; overwrite previously defined php.ini values, but will append the new value
+; instead.
+
+; Note: path INI options can be relative and will be expanded with the prefix
+; (pool, global or /usr/lib/php5.3)
+
+; Default Value: nothing is defined by default except the values in php.ini and
+;                specified at startup with the -d argument
+;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+;php_flag[display_errors] = off
+;php_admin_value[error_log] = /var/log/fpm-php.www.log
+;php_admin_flag[log_errors] = on
+;php_admin_value[memory_limit] = 32M
diff --git a/dev-lang/php/files/php-fpm.init b/dev-lang/php/files/php-fpm.init
new file mode 100755
index 0000000..adcfd32
--- /dev/null
+++ b/dev-lang/php/files/php-fpm.init
@@ -0,0 +1,22 @@
+#!/sbin/runscript
+
+PHP_FPM_CONF="/etc/php/fpm-php5/php-fpm.conf"
+
+opts="depend start stop reload"
+
+depend() {
+	need net
+	use apache2 lighttpd nginx
+}
+
+start() {
+	ebegin "Starting PHP FastCGI server"
+	start-stop-daemon --start --exec /usr/bin/php-fpm -- -y "${PHP_FPM_CONF}"
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping PHP FastCGI server"
+	start-stop-daemon --stop --name php-fpm
+	eend $?
+}
diff --git a/dev-lang/php/files/php-fpm_at-simple.service b/dev-lang/php/files/php-fpm_at-simple.service
new file mode 100644
index 0000000..5f0482e
--- /dev/null
+++ b/dev-lang/php/files/php-fpm_at-simple.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=The PHP FastCGI Process Manager
+After=network.target
+
+[Service]
+Type=simple
+PIDFile=/run/php-fpm/php-fpm-%I.pid
+ExecStart=/usr/libexec/php-fpm-launcher php%I -y /etc/php/fpm-php%I/php-fpm.conf --nodaemonize
+ExecReload=/bin/kill -USR2 $MAINPID
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dev-lang/php/files/php-fpm_at.service b/dev-lang/php/files/php-fpm_at.service
new file mode 100644
index 0000000..152c1ab
--- /dev/null
+++ b/dev-lang/php/files/php-fpm_at.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=The PHP FastCGI Process Manager
+After=network.target
+
+[Service]
+Type=notify
+PIDFile=/run/php-fpm/php-fpm-%I.pid
+ExecStart=/usr/libexec/php-fpm-launcher php%I -y /etc/php/fpm-php%I/php-fpm.conf --nodaemonize
+ExecReload=/bin/kill -USR2 $MAINPID
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/dev-lang/php/files/php4-ldvs b/dev-lang/php/files/php4-ldvs
new file mode 100644
index 0000000..01b4eeb
--- /dev/null
+++ b/dev-lang/php/files/php4-ldvs
@@ -0,0 +1 @@
+PHP_4 { global: *; };
diff --git a/dev-lang/php/files/php5-ldvs b/dev-lang/php/files/php5-ldvs
new file mode 100644
index 0000000..783b0f6
--- /dev/null
+++ b/dev-lang/php/files/php5-ldvs
@@ -0,0 +1 @@
+PHP_5 { global: *; };
diff --git a/dev-lang/php/files/php529-ds-odbc64.patch b/dev-lang/php/files/php529-ds-odbc64.patch
new file mode 100644
index 0000000..249b948
--- /dev/null
+++ b/dev-lang/php/files/php529-ds-odbc64.patch
@@ -0,0 +1,16 @@
+diff -dPNur php-5.2.9/ext/pdo_odbc/php_pdo_odbc_int.h php-5.2.9-new/ext/pdo_odbc/php_pdo_odbc_int.h
+--- php-5.2.9/ext/pdo_odbc/php_pdo_odbc_int.h	2008-12-31 12:17:42.000000000 +0100
++++ php-5.2.9-new/ext/pdo_odbc/php_pdo_odbc_int.h	2009-06-15 01:35:47.000000000 +0200
+@@ -134,7 +134,11 @@
+ typedef struct {
+ 	char *data;
+ 	unsigned long datalen;
+-	long fetched_len;
++#ifdef SQLLEN
++	SQLLEN fetched_len;
++#else
++	SQLINTEGER fetched_len;
++#endif
+ 	SWORD	coltype;
+ 	char colname[128];
+ 	unsigned is_long;
diff --git a/dev-lang/php/files/php532-ds-odbc_timeout.patch b/dev-lang/php/files/php532-ds-odbc_timeout.patch
new file mode 100644
index 0000000..0014420
--- /dev/null
+++ b/dev-lang/php/files/php532-ds-odbc_timeout.patch
@@ -0,0 +1,43 @@
+diff -dPNur php-5.3.2/ext/pdo_odbc/odbc_driver.c php-5.3.2-ds/ext/pdo_odbc/odbc_driver.c
+--- php-5.3.2/ext/pdo_odbc/odbc_driver.c	2010-02-03 20:48:04.000000000 +0100
++++ php-5.3.2-ds/ext/pdo_odbc/odbc_driver.c	2010-08-08 00:43:03.000000000 +0200
+@@ -338,11 +338,17 @@
+ 
+ static int odbc_handle_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC)
+ {
++	SQLRETURN ret;
+ 	pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
+ 	switch (attr) {
+ 		case PDO_ODBC_ATTR_ASSUME_UTF8:
+ 			H->assume_utf8 = zval_is_true(val);
+ 			return 1;
++		case PDO_ATTR_TIMEOUT:
++			convert_to_long(val);
++			ret = SQLSetConnectAttr(H->dbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)Z_LVAL_P(val), SQL_IS_UINTEGER);
++			if ((ret == SQL_SUCCESS)||(ret == SQL_SUCCESS_WITH_INFO)) return 1;
++			return 0;
+ 		default:
+ 			strcpy(H->einfo.last_err_msg, "Unknown Attribute");
+ 			H->einfo.what = "setAttribute";
+@@ -394,6 +400,7 @@
+ 	RETCODE rc;
+ 	int use_direct = 0;
+ 	SQLUINTEGER cursor_lib;
++	SQLUINTEGER timeout;
+ 
+ 	H = pecalloc(1, sizeof(*H), dbh->is_persistent);
+ 
+@@ -438,6 +445,12 @@
+ 		goto fail;
+ 	}
+ 
++	timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, -1 TSRMLS_CC);
++	if (timeout != (SQLUINTEGER)-1) {
++	    SQLSetConnectAttr(H->dbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
++	    SQLSetConnectAttr(H->dbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
++	}
++
+ 	if (strchr(dbh->data_source, ';')) {
+ 		char dsnbuf[1024];
+ 		short dsnbuflen;
+diff -dPNur php-5.3.2/php529-ds-odbc_timeout.patch php-5.3.2-ds/php529-ds-odbc_timeout.patch
diff --git a/dev-lang/php/files/php547-ds-odbc_blob.patch b/dev-lang/php/files/php547-ds-odbc_blob.patch
new file mode 100644
index 0000000..041ce84
--- /dev/null
+++ b/dev-lang/php/files/php547-ds-odbc_blob.patch
@@ -0,0 +1,19 @@
+diff -dPNur php-5.3.2/ext/pdo_odbc/odbc_stmt.c php-5.3.2-ds/ext/pdo_odbc/odbc_stmt.c
+--- php-5.3.2/ext/pdo_odbc/odbc_stmt.c	2010-01-03 10:23:27.000000000 +0100
++++ php-5.3.2-ds/ext/pdo_odbc/odbc_stmt.c	2010-08-08 01:00:46.000000000 +0200
+@@ -569,9 +569,15 @@
+ 			return 0;
+ 		}
+ 	}
++
++	if (displaysize < 0) {
++	    col->maxlen = S->cols[colno].datalen = 0;
++	    colsize = 256;
++	} else {
+ 	colsize = displaysize;
+ 
+ 	col->maxlen = S->cols[colno].datalen = colsize;
++	}
+ 	col->namelen = colnamelen;
+ 	col->name = estrdup(S->cols[colno].colname);
+ 	S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype);
diff --git a/dev-lang/php/php-5.5.17-r1.ebuild b/dev-lang/php/php-5.5.17-r1.ebuild
new file mode 100644
index 0000000..8f1915e
--- /dev/null
+++ b/dev-lang/php/php-5.5.17-r1.ebuild
@@ -0,0 +1,790 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/php/php-5.5.17.ebuild,v 1.1 2014/09/19 12:14:27 olemarkus Exp $
+
+EAPI=5
+
+inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
+
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+
+function php_get_uri ()
+{
+	case "${1}" in
+		"php-pre")
+			echo "http://downloads.php.net/dsp/${2}"
+		;;
+		"php")
+			echo "http://www.php.net/distributions/${2}"
+		;;
+		"olemarkus")
+			echo "http://dev.gentoo.org/~olemarkus/php/${2}"
+		;;
+		"gentoo")
+			echo "mirror://gentoo/${2}"
+		;;
+		*)
+			die "unhandled case in php_get_uri"
+		;;
+	esac
+}
+
+PHP_MV="$(get_major_version)"
+SLOT="$(get_version_component_range 1-2)"
+
+# alias, so we can handle different types of releases (finals, rcs, alphas,
+# betas, ...) w/o changing the whole ebuild
+PHP_PV="${PV/_rc/RC}"
+PHP_PV="${PHP_PV/_alpha/alpha}"
+PHP_PV="${PHP_PV/_beta/beta}"
+PHP_RELEASE="php"
+[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
+[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
+[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
+PHP_P="${PN}-${PHP_PV}"
+
+PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
+
+PHP_FPM_CONF_VER="1"
+
+SRC_URI="${PHP_SRC_URI}"
+
+DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
+HOMEPAGE="http://php.net/"
+LICENSE="PHP-3"
+
+S="${WORKDIR}/${PHP_P}"
+
+# We can build the following SAPIs in the given order
+SAPIS="embed cli cgi fpm apache2"
+
+# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
+IUSE="${IUSE}
+	${SAPIS/cli/+cli}
+	threads"
+
+IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
+	crypt +ctype curl debug
+	enchant exif frontbase +fileinfo +filter firebird
+	flatfile ftp gd gdbm gmp +hash +iconv imap inifile
+	intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
+	mssql mysql libmysqlclient mysqli nls
+	oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
+	readline recode selinux +session sharedmem
+	+simplexml snmp soap sockets spell sqlite ssl
+	sybase-ct sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
+	+xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
+
+DEPEND="
+	>=app-admin/eselect-php-0.7.1-r3[apache2?,fpm?]
+	>=dev-libs/libpcre-8.32[unicode]
+	apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
+		<www-servers/apache-2.4[threads=] ) )
+	berkdb? ( =sys-libs/db-4* )
+	bzip2? ( app-arch/bzip2 )
+	cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
+	cjk? ( !gd? (
+		virtual/jpeg:0
+		media-libs/libpng:0=
+		sys-libs/zlib
+	) )
+	crypt? ( >=dev-libs/libmcrypt-2.4 )
+	curl? ( >=net-misc/curl-7.10.5 )
+	enchant? ( app-text/enchant )
+	exif? ( !gd? (
+		virtual/jpeg:0
+		media-libs/libpng:0=
+		sys-libs/zlib
+	) )
+	firebird? ( dev-db/firebird )
+	gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
+	gdbm? ( >=sys-libs/gdbm-1.8.0 )
+	gmp? ( >=dev-libs/gmp-4.1.2 )
+	iconv? ( virtual/libiconv )
+	imap? ( virtual/imap-c-client[ssl=] )
+	intl? ( dev-libs/icu:= )
+	iodbc? ( dev-db/libiodbc )
+	kerberos? ( virtual/krb5 )
+	ldap? ( >=net-nds/openldap-1.2.11 )
+	ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
+	libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
+	mssql? ( dev-db/freetds[mssql] )
+	libmysqlclient? (
+		mysql? ( virtual/mysql )
+		mysqli? ( >=virtual/mysql-4.1 )
+	)
+	nls? ( sys-devel/gettext )
+	oci8-instant-client? ( dev-db/oracle-instantclient-basic )
+	odbc? ( >=dev-db/unixODBC-1.8.13 )
+	postgres? ( dev-db/postgresql-base )
+	qdbm? ( dev-db/qdbm )
+	readline? ( sys-libs/readline )
+	recode? ( app-text/recode )
+	sharedmem? ( dev-libs/mm )
+	simplexml? ( >=dev-libs/libxml2-2.6.8 )
+	snmp? ( >=net-analyzer/net-snmp-5.2 )
+	soap? ( >=dev-libs/libxml2-2.6.8 )
+	spell? ( >=app-text/aspell-0.50 )
+	sqlite? ( >=dev-db/sqlite-3.7.6.3 )
+	ssl? ( >=dev-libs/openssl-0.9.7 )
+	sybase-ct? ( dev-db/freetds )
+	tidy? ( app-text/htmltidy )
+	truetype? (
+		=media-libs/freetype-2*
+		>=media-libs/t1lib-5.0.0
+		!gd? (
+			virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
+	)
+	unicode? ( dev-libs/oniguruma )
+	vpx? ( media-libs/libvpx )
+	wddx? ( >=dev-libs/libxml2-2.6.8 )
+	xml? ( >=dev-libs/libxml2-2.6.8 )
+	xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
+	xmlreader? ( >=dev-libs/libxml2-2.6.8 )
+	xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
+	xpm? (
+		x11-libs/libXpm
+		virtual/jpeg:0
+		media-libs/libpng:0= sys-libs/zlib
+	)
+	xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
+	zip? ( sys-libs/zlib )
+	zlib? ( sys-libs/zlib )
+	virtual/mta
+"
+
+php="=${CATEGORY}/${PF}"
+
+REQUIRED_USE="
+	truetype? ( gd )
+	vpx? ( gd )
+	cjk? ( gd )
+	exif? ( gd )
+
+	xpm? ( gd )
+	gd? ( zlib )
+	simplexml? ( xml )
+	soap? ( xml )
+	wddx? ( xml )
+	xmlrpc? ( || ( xml iconv ) )
+	xmlreader? ( xml )
+	xslt? ( xml )
+	ldap-sasl? ( ldap )
+	mhash? ( hash )
+	phar? ( hash )
+	libmysqlclient? ( || (
+		mysql
+		mysqli
+		pdo
+	) )
+
+	qdbm? ( !gdbm )
+	readline? ( !libedit )
+	recode? ( !imap !mysql !mysqli )
+	sharedmem? ( !threads )
+
+	!cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
+
+RDEPEND="${DEPEND}"
+
+RDEPEND="${RDEPEND}
+	fpm? (
+		selinux? ( sec-policy/selinux-phpfpm )
+		systemd? ( sys-apps/systemd ) )"
+
+DEPEND="${DEPEND}
+	sys-devel/flex
+	>=sys-devel/m4-1.4.3
+	>=sys-devel/libtool-1.5.18"
+
+# Allow users to install production version if they want to
+
+case "${PHP_INI_VERSION}" in
+	production|development)
+		;;
+	*)
+		PHP_INI_VERSION="development"
+		;;
+esac
+
+PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
+PHP_INI_FILE="php.ini"
+
+want_apache
+
+pkg_setup() {
+	depend.apache_pkg_setup
+}
+
+php_install_ini() {
+	local phpsapi="${1}"
+
+	# work out where we are installing the ini file
+	php_set_ini_dir "${phpsapi}"
+
+	local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
+	cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
+
+	# default to /tmp for save_path, bug #282768
+	sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
+
+	# Set the extension dir
+	sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
+
+	# Set the include path to point to where we want to find PEAR packages
+	sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
+
+	dodir "${PHP_INI_DIR#${EPREFIX}}"
+	insinto "${PHP_INI_DIR#${EPREFIX}}"
+	newins "${phpinisrc}" "${PHP_INI_FILE}"
+
+	elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
+	elog
+
+	dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
+	dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
+
+	if use_if_iuse opcache; then
+		elog "Adding opcache to $PHP_EXT_INI_DIR"
+		echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
+		dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
+	fi
+
+	# SAPI-specific handling
+
+	if [[ "${sapi}" == "fpm" ]] ; then
+		[[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
+		einfo "Installing FPM CGI config file php-fpm.conf"
+		insinto "${PHP_INI_DIR#${EPREFIX}}"
+		newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
+
+		# Remove bogus /etc/php-fpm.conf.default (bug 359906)
+		[[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
+	fi
+
+	# Install PHP ini files into /usr/share/php
+
+	dodoc php.ini-development
+	dodoc php.ini-production
+
+}
+
+php_set_ini_dir() {
+	PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
+	PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
+	PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
+}
+
+src_prepare() {
+#SDS
+#    epatch "${FILESDIR}"/php529-ds-odbc64.patch || die
+    epatch "${FILESDIR}"/php547-ds-odbc_blob.patch || die
+    epatch "${FILESDIR}"/php532-ds-odbc_timeout.patch || die
+#EDS
+
+	# USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
+	# ([empty session.save_path]/session_mm_[sapi][gid].sem)
+	# there is no easy way to circumvent that, all php calls during
+	# install use -n, so no php.ini file will be used.
+	# As such, this is the easiest way to get around
+	addpredict /session_mm_cli250.sem
+	addpredict /session_mm_cli0.sem
+
+	# Change PHP branding
+	# Get the alpha/beta/rc version
+	sed -re	"s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
+		-i configure.in || die "Unable to change PHP branding"
+
+	# Patch PHP to show Gentoo as the server platform
+	sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
+		-i configure.in || die "Failed to fix server platform name"
+
+	# Prevent PHP from activating the Apache config,
+	# as we will do that ourselves
+	sed -i \
+		-e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		-e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
+		configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
+
+	# Patch PHP to support heimdal instead of mit-krb5
+	if has_version "app-crypt/heimdal" ; then
+		sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal libname"
+		sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
+			|| die "Failed to fix heimdal crypt library reference"
+	fi
+
+	#Add user patches #357637
+	epatch_user
+
+	#force rebuilding aclocal.m4
+	rm aclocal.m4
+	eautoreconf
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# http://bugs.php.net/bug.php?id=48795, bug #343481
+		sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
+	fi
+}
+
+src_configure() {
+	addpredict /usr/share/snmp/mibs/.index
+	addpredict /var/lib/net-snmp/mib_indexes
+
+	PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
+
+	# This is a global variable and should be in caps. It isn't because the
+	# phpconfutils eclass relies on exactly this name...
+	# for --with-libdir see bug #327025
+	my_conf="
+		--prefix="${PHP_DESTDIR}"
+		--mandir="${PHP_DESTDIR}"/man
+		--infodir="${PHP_DESTDIR}"/info
+		--libdir="${PHP_DESTDIR}"/lib
+		--with-libdir=$(get_libdir)
+		--without-pear
+		$(use_enable threads maintainer-zts)"
+
+	#                             extension		  USE flag        shared
+	my_conf+="
+	$(use_enable bcmath bcmath )
+	$(use_with bzip2 bz2 "${EPREFIX}"/usr)
+	$(use_enable calendar calendar )
+	$(use_enable ctype ctype )
+	$(use_with curl curl "${EPREFIX}"/usr)
+	$(use_enable xml dom )
+	$(use_with enchant enchant "${EPREFIX}"/usr)
+	$(use_enable exif exif )
+	$(use_enable fileinfo fileinfo )
+	$(use_enable filter filter )
+	$(use_enable ftp ftp )
+	$(use_with nls gettext "${EPREFIX}"/usr)
+	$(use_with gmp gmp "${EPREFIX}"/usr)
+	$(use_enable hash hash )
+	$(use_with mhash mhash "${EPREFIX}"/usr)
+	$(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
+	$(use_enable intl intl )
+	$(use_enable ipv6 ipv6 )
+	$(use_enable json json )
+	$(use_with kerberos kerberos "${EPREFIX}"/usr)
+	$(use_enable xml libxml )
+	$(use_with xml libxml-dir "${EPREFIX}"/usr)
+	$(use_enable unicode mbstring )
+	$(use_with crypt mcrypt "${EPREFIX}"/usr)
+	$(use_with mssql mssql "${EPREFIX}"/usr)
+	$(use_with unicode onig "${EPREFIX}"/usr)
+	$(use_with ssl openssl "${EPREFIX}"/usr)
+	$(use_with ssl openssl-dir "${EPREFIX}"/usr)
+	$(use_enable pcntl pcntl )
+	$(use_enable phar phar )
+	$(use_enable pdo pdo )
+	$(use_enable opcache opcache )
+	$(use_with postgres pgsql "${EPREFIX}"/usr)
+	$(use_enable posix posix )
+	$(use_with spell pspell "${EPREFIX}"/usr)
+	$(use_with recode recode "${EPREFIX}"/usr)
+	$(use_enable simplexml simplexml )
+	$(use_enable sharedmem shmop )
+	$(use_with snmp snmp "${EPREFIX}"/usr)
+	$(use_enable soap soap )
+	$(use_enable sockets sockets )
+	$(use_with sqlite sqlite3 "${EPREFIX}"/usr)
+	$(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
+	$(use_enable sysvipc sysvmsg )
+	$(use_enable sysvipc sysvsem )
+	$(use_enable sysvipc sysvshm )
+	$(use_with systemd fpm-systemd)
+	$(use_with tidy tidy "${EPREFIX}"/usr)
+	$(use_enable tokenizer tokenizer )
+	$(use_enable wddx wddx )
+	$(use_enable xml xml )
+	$(use_enable xmlreader xmlreader )
+	$(use_enable xmlwriter xmlwriter )
+	$(use_with xmlrpc xmlrpc)
+	$(use_with xslt xsl "${EPREFIX}"/usr)
+	$(use_enable zip zip )
+	$(use_with zlib zlib "${EPREFIX}"/usr)
+	$(use_enable debug debug )"
+
+	# DBA support
+	if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
+		|| use qdbm ; then
+		my_conf="${my_conf} --enable-dba${shared}"
+	fi
+
+	# DBA drivers support
+	my_conf+="
+	$(use_with cdb cdb)
+	$(use_with berkdb db4 ${EPREFIX}/usr)
+	$(use_enable flatfile flatfile )
+	$(use_with gdbm gdbm ${EPREFIX}/usr)
+	$(use_enable inifile inifile )
+	$(use_with qdbm qdbm ${EPREFIX}/usr)"
+
+	# Support for the GD graphics library
+	my_conf+="
+	$(use_with truetype freetype-dir ${EPREFIX}/usr)
+	$(use_with truetype t1lib ${EPREFIX}/usr)
+	$(use_enable cjk gd-jis-conv )
+	$(use_with gd jpeg-dir ${EPREFIX}/usr)
+	$(use_with gd png-dir ${EPREFIX}/usr)
+	$(use_with xpm xpm-dir ${EPREFIX}/usr)
+	$(use_with vpx vpx-dir ${EPREFIX}/usr)"
+	# enable gd last, so configure can pick up the previous settings
+	my_conf+="
+	$(use_with gd gd)"
+
+	# IMAP support
+	if use imap ; then
+		my_conf+="
+		$(use_with imap imap ${EPREFIX}/usr)
+		$(use_with ssl imap-ssl ${EPREFIX}/usr)"
+	fi
+
+	# Interbase/firebird support
+
+	if use firebird ; then
+		my_conf+="
+		$(use_with firebird interbase ${EPREFIX}/usr)"
+	fi
+
+	# LDAP support
+	if use ldap ; then
+		my_conf+="
+		$(use_with ldap ldap ${EPREFIX}/usr)
+		$(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
+	fi
+
+	# MySQL support
+	local mysqllib="mysqlnd"
+	local mysqlilib="mysqlnd"
+	use libmysqlclient && mysqllib="${EPREFIX}/usr"
+	use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
+
+	my_conf+=" $(use_with mysql mysql $mysqllib)"
+	my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
+
+	local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
+	if use mysql ; then
+		my_conf+="${mysqlsock}"
+	elif use mysqli ; then
+		my_conf+="${mysqlsock}"
+	fi
+
+	# ODBC support
+	if use odbc ; then
+		my_conf+="
+		$(use_with odbc unixODBC ${EPREFIX}/usr)"
+	fi
+
+	if use iodbc ; then
+		my_conf+="
+		$(use_with iodbc iodbc ${EPREFIX}/usr)"
+	fi
+
+	# Oracle support
+	if use oci8-instant-client ; then
+		my_conf+="
+		$(use_with oci8-instant-client oci8)"
+	fi
+
+	# PDO support
+	if use pdo ; then
+		my_conf+="
+		$(use_with mssql pdo-dblib )
+		$(use_with mysql pdo-mysql ${mysqllib})
+		$(use_with postgres pdo-pgsql )
+		$(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
+		$(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
+		if use oci8-instant-client ; then
+			my_conf+="
+			$(use_with oci8-instant-client pdo-oci)"
+		fi
+	fi
+
+	# readline/libedit support
+	my_conf+="
+	$(use_with readline readline ${EPREFIX}/usr)
+	$(use_with libedit libedit ${EPREFIX}/usr)"
+
+	# Session support
+	if use session ; then
+		my_conf+="
+		$(use_with sharedmem mm ${EPREFIX}/usr)"
+	else
+		my_conf+="
+		$(use_enable session session )"
+	fi
+
+	# Use pic for shared modules such as apache2's mod_php
+	my_conf="${my_conf} --with-pic"
+
+	# we use the system copy of pcre
+	# --with-pcre-regex affects ext/pcre
+	# --with-pcre-dir affects ext/filter and ext/zip
+	my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
+
+	# Catch CFLAGS problems
+	# Fixes bug #14067.
+	# Changed order to run it in reverse for bug #32022 and #12021.
+	replace-cpu-flags "k6*" "i586"
+
+	# Support user-passed configuration parameters
+	my_conf="${my_conf} ${EXTRA_ECONF:-}"
+
+	# Support the Apache2 extras, they must be set globally for all
+	# SAPIs to work correctly, especially for external PHP extensions
+
+	mkdir -p "${WORKDIR}/sapis-build"
+	for one_sapi in $SAPIS ; do
+		use "${one_sapi}" || continue
+		php_set_ini_dir "${one_sapi}"
+
+		cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
+		cd "${WORKDIR}/sapis-build/${one_sapi}"
+
+		sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
+			--with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
+
+		for sapi in $SAPIS ; do
+			case "$sapi" in
+				cli|cgi|embed|fpm)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --enable-${sapi}"
+					else
+						sapi_conf="${sapi_conf} --disable-${sapi}"
+					fi
+					;;
+
+				apache2)
+					if [[ "${one_sapi}" == "${sapi}" ]] ; then
+						sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
+					else
+						sapi_conf="${sapi_conf} --without-apxs2"
+					fi
+					;;
+			esac
+		done
+
+		econf ${sapi_conf}
+	done
+}
+
+src_compile() {
+	# snmp seems to run during src_compile, too (bug #324739)
+	addpredict /usr/share/snmp/mibs/.index
+	addpredict /var/lib/net-snmp/mib_indexes
+
+	for sapi in ${SAPIS} ; do
+		if use "${sapi}"; then
+			cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
+			emake || die "emake failed"
+		fi
+	done
+}
+
+src_install() {
+	# see bug #324739 for what happens when we don't have that
+	addpredict /usr/share/snmp/mibs/.index
+
+	# grab the first SAPI that got built and install common files from there
+	local first_sapi=""
+	for sapi in $SAPIS ; do
+		if use $sapi ; then
+			first_sapi=$sapi
+			break
+		fi
+	done
+
+	# Makefile forgets to create this before trying to write to it...
+	dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
+
+	# Install php environment (without any sapis)
+	cd "${WORKDIR}/sapis-build/$first_sapi"
+	emake INSTALL_ROOT="${D}" \
+		install-build install-headers install-programs \
+		|| die "emake install failed"
+
+	local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
+
+	# Create the directory where we'll put version-specific php scripts
+	keepdir /usr/share/php${PHP_MV}
+
+	local sapi="", file=""
+	local sapi_list=""
+
+	for sapi in ${SAPIS}; do
+		if use "${sapi}" ; then
+			einfo "Installing SAPI: ${sapi}"
+			cd "${WORKDIR}/sapis-build/${sapi}"
+
+			if [[ "${sapi}" == "apache2" ]] ; then
+				# We're specifically not using emake install-sapi as libtool
+				# may cause unnecessary relink failures (see bug #351266)
+				insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
+				newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
+				keepdir "/usr/$(get_libdir)/apache2/modules"
+			else
+				# needed each time, php_install_ini would reset it
+				local dest="${PHP_DESTDIR#${EPREFIX}}"
+				into "${dest}"
+				case "$sapi" in
+					cli)
+						source="sapi/cli/php"
+						;;
+					cgi)
+						source="sapi/cgi/php-cgi"
+						;;
+					fpm)
+						source="sapi/fpm/php-fpm"
+						;;
+					embed)
+						source="libs/libphp${PHP_MV}$(get_libname)"
+						;;
+					*)
+						die "unhandled sapi in src_install"
+						;;
+				esac
+
+				if [[ "${source}" == *"$(get_libname)" ]]; then
+					dolib.so "${source}" || die "Unable to install ${sapi} sapi"
+				else
+					dobin "${source}" || die "Unable to install ${sapi} sapi"
+					local name="$(basename ${source})"
+					dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
+				fi
+			fi
+
+			php_install_ini "${sapi}"
+
+			# construct correct SAPI string for php-config
+			# thanks to ferringb for the bash voodoo
+			if [[ "${sapi}" == "apache2" ]]; then
+				sapi_list="${sapi_list:+${sapi_list} }apache2handler"
+			else
+				sapi_list="${sapi_list:+${sapi_list} }${sapi}"
+			fi
+		fi
+	done
+
+	# Installing opcache module
+	if use_if_iuse opcache ; then
+		dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
+	fi
+
+	# Install env.d files
+	newenvd "${FILESDIR}/20php5-envd" \
+		"20php${SLOT}"
+	sed -e "s|/lib/|/$(get_libdir)/|g" -i \
+		"${ED}/etc/env.d/20php${SLOT}"
+	sed -e "s|php5|php${SLOT}|g" -i \
+		"${ED}/etc/env.d/20php${SLOT}"
+
+	# set php-config variable correctly (bug #278439)
+	sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
+		"${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
+
+	if use fpm ; then
+		if use systemd; then
+			systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
+		else
+			systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
+		fi
+	fi
+}
+
+src_test() {
+	echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+	PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
+	if [[ ! -x "${PHP_BIN}" ]] ; then
+		ewarn "Test phase requires USE=cli, skipping"
+		return
+	else
+		export TEST_PHP_EXECUTABLE="${PHP_BIN}"
+	fi
+
+	if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
+		export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
+	fi
+
+	REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n  -d "session.save_path=${T}" \
+		"${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
+
+	for name in ${EXPECTED_TEST_FAILURES}; do
+		mv "${name}.out" "${name}.out.orig" 2>/dev/null
+	done
+
+	local failed="$(find -name '*.out')"
+	if [[ ${failed} != "" ]] ; then
+		ewarn "The following test cases failed unexpectedly:"
+		for name in ${failed}; do
+			ewarn "  ${name/.out/}"
+		done
+	else
+		einfo "No unexpected test failures, all fine"
+	fi
+
+	if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
+		local passed=""
+		for name in ${EXPECTED_TEST_FAILURES}; do
+			[[ -f "${name}.diff" ]] && continue
+			passed="${passed} ${name}"
+		done
+		if [[ ${passed} != "" ]] ; then
+			einfo "The following test cases passed unexpectedly:"
+			for name in ${passed}; do
+				ewarn "  ${passed}"
+			done
+		else
+			einfo "None of the known-to-fail tests passed, all fine"
+		fi
+	fi
+}
+
+pkg_postinst() {
+	# Output some general info to the user
+	if use apache2 ; then
+		APACHE2_MOD_DEFINE="PHP5"
+		APACHE2_MOD_CONF="70_mod_php5"
+		apache-module_pkg_postinst
+	fi
+
+	# Create the symlinks for php
+	for m in ${SAPIS}; do
+		[[ ${m} == 'embed' ]] && continue;
+		if use $m ; then
+			local ci=$(eselect php show $m)
+			if [[ -z $ci ]]; then
+				eselect php set $m php${SLOT}
+				einfo "Switched ${m} to use php:${SLOT}"
+				einfo
+			elif [[ $ci != "php${SLOT}" ]] ; then
+				elog "To switch $m to use php:${SLOT}, run"
+				elog "    eselect php set $m php${SLOT}"
+				elog
+			fi
+		fi
+	done
+
+	elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
+	elog "to compile extensions for the ${SLOT} ABI"
+	elog
+	if ! use readline && use cli ; then
+		ewarn "Note that in order to use php interactivly, you need to enable"
+		ewarn "the readline USE flag or php -a will hang"
+	fi
+	elog
+	elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
+	elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
+	elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
+	elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
+
+	elog
+	elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
+	elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"
+	elog
+}
+
+pkg_prerm() {
+	eselect php cleanup
+}
-- 
cgit v1.2.3