S
S
slava kk2020-04-01 17:56:07
PHP
slava kk, 2020-04-01 17:56:07

Compress (minify) a PHP file?

My server sends a php file for download with html, css elements, etc. (Script installer), how can I compress it into one line (Just like compressing JS, etc.)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nokimaro, 2020-04-01
@nokimaro

And what's the point in that?
js, css are compressed so that they take up less space when transmitted over the network.
Why is it for PHP? just "from prying eyes"? then immediately fasten the obfuscator
But you can do what you want with the php_strip_whitespace() function ( I was surprised to find out that there is one )
Or through cli php -w

T
ThunderCat, 2020-04-01
@ThunderCat

str_replace("\n",'',$body); Well, and / or rumble whitespace characters with regular expressions.

X
xmoonlight, 2020-04-01
@xmoonlight

If the script installer, being itself an executable PHP script, is not readable or complex, this means that its author is not sure that its own code is safe and the server is secure.
I would not just run it even if I cannot "read" it and understand the logic of what it will do.
Briefly: clean and readable code in zip and give it to download.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question