Skip to content

Instantly share code, notes, and snippets.

@p

p/1

Created November 25, 2011 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p/1394268 to your computer and use it in GitHub Desktop.
Save p/1394268 to your computer and use it in GitHub Desktop.
Executing phar files
(14:23:02) nn-: (13:36:13) naderman: you can easily install the phar extension - not that easy really
(14:23:16) nn-: i still cannot get php to execute phar files
(14:23:28) nn-: either on my system or on a fresh debian install i tried yesterday
(14:23:34) naderman: do you have suhosin?
(14:23:39) nn-: i do
(14:23:39) naderman: debian comes with suhosin
(14:23:46) naderman: it breaks phar by default unless you add some setting
(14:23:47) naderman: one sec
(14:24:19) naderman: http://silex.sensiolabs.org/doc/usage.html#pitfalls
(14:24:40) nn-: i'm pretty sure i did that
(14:25:00) nn-: on debian php simply quits with no output
(14:25:02) naderman: pretty sure it would work then
(14:25:15) naderman: yeah that's what happens if you are missing the suhosin one
(14:25:18) nn-: that's the standard error handling strategy in phpland, no surprises there
(14:25:23) naderman: suhosin.executor.include.whitelist = phar
(14:25:29) nn-: on my system it insists the file is in utf-32le which it can't deal with
(14:25:39) naderman: detect_unicode = Off
(14:25:43) nn-: but if i include it with phar:// it works
(14:25:44) naderman: all in that list
(14:25:54) naderman: yes cause it then doesn't try to guess
(14:26:12) naderman: detect_unicode only applies to regularly included files
(14:27:54) nn-: is detect_unicode going to break php with actual unicode files?
(14:28:04) naderman: no
(14:28:27) naderman: well if you use actual php with non-utf8 unicode encodings I think it might under some circumstances
(14:28:36) naderman: but nobody does that anyway
(14:28:51) naderman: and if it has a BOM it'll still work then I think
(14:31:16) nn-: why does php phar://`pwd`/file.phar not work?
(14:31:23) nn-: always says it can't find the file
(14:35:10) naderman: do you have all of those settings set now?
(14:35:11) naderman: suhosin.executor.include.whitelist = phar
(14:35:12) naderman: ?
(14:35:19) naderman: oh
(14:35:24) naderman: phar:// doesn't work there I think
(14:35:30) naderman: you can only specify a path
(14:35:34) naderman: not some php stream
(14:35:56) nn-: that's convenient
(14:36:09) naderman: well there's no need to use phar://
(14:36:12) naderman: just use the regular path
(14:36:34) nn-: if i use phar:// i don't have to change unicode setting, correct?
(14:36:38) naderman: only reason you might need phar:// is if you actually want to access stuff inside of the phar and not just the file itself
(14:36:42) naderman: I have no idea
(14:36:44) naderman: it seems so
(14:36:47) naderman: but who knows
(14:36:50) naderman: it's php ...
(14:36:50) nn-: that would be the reason then
(14:37:10) nn-: suhosin i don't understand either
(14:37:10) naderman: just change the setting ...
(14:37:19) naderman: suhosin blacklists phar by default
(14:37:22) naderman: please just apply those settings
(14:37:31) nn-: are you saying suhosin completely stops phar from working?
(14:37:33) naderman: and then after that ask if it still doesn#t work
(14:37:37) naderman: yes
(14:37:52) naderman: or maybe some part of it works
(14:37:53) naderman: who knows
(14:37:57) naderman: if you make that setting change it works
(14:38:00) naderman: that's what matters
(14:39:17) nn-: you're talking to me like i'm some windows user
(14:39:32) naderman: I'm talking to you like I gave you the solution 5 minutes ago
(14:39:35) naderman: but you refuse to apply it
(14:39:39) naderman: and instead keep asking questions
(14:39:45) nn-: no, i said i would apply it
(14:39:54) nn-: but separately from that i'm trying to understand what the solution does
(14:39:55) naderman: if you want to know why those settings are necessary, figure it out yourself
(14:40:15) naderman: I really can't be bothered to work out every reason for why php is as broken as it is
(14:40:27) naderman: well go ahead and let me know once you have
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment