Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shebang prevents execution #49

Closed
Olli opened this issue Feb 1, 2017 · 17 comments
Closed

Shebang prevents execution #49

Olli opened this issue Feb 1, 2017 · 17 comments

Comments

@Olli
Copy link

Olli commented Feb 1, 2017

The bundle.js gets a shebang (contao-manager.phar is used) so it's throwing an js syntax error.
Also the contao-manager.phar generates html that has a shebang on beginning which results in faulty html.

@discordier
Copy link

What is your server configuration? Apache, nginx?
What is your PHP configuration? mod_php, php-fcgi, cgi?

Please provide us with output from phpinfo() and ensure output buffering is present.
We are handling this case explicitely here.

@Olli
Copy link
Author

Olli commented Feb 4, 2017

Hosting-Provider: All-Inkl
Server: apache
PHP: FPM/FastCGI
What information from phpinfo should I provide? I don't want to post this huge html here.
output_buffering has "no value".
I assume output buffering works - otherwise it wouldn't interpret the app.php .
The html output (and js also) only have the shebang on the beginning.

@discordier
Copy link

I finally found the reason for the shebang line at least for phars compiled on Windows.
You most likely have git config core.autocrlf set to true. This breaks the parser in pharpiler as we never thought about git replacing the line endings of the files.
If you would use a proper checkout containing lf the generated binary should work.

I will add an .gitattributes file which will enforce force the line endings, however, you should also fix your git config.

@Olli
Copy link
Author

Olli commented Feb 7, 2017

Ok did a complete new clone of the git respo and rebuild the phar.
It's the same problem like before. I use Debian Linux.

@discordier
Copy link

I can not reproduce this...

Anyone else?

@Olli
Copy link
Author

Olli commented Feb 9, 2017

Do you need anything for investigation? FTP access?
Am I right? There should be no shebang at the beginning of the contao-manager.phar ?
If it's not right then it's a problem of the hosting provider. If it's right then it's a problem of the building process. Then maybe we should compare the composer.lock .
There must be a solution for this. :)

@discordier
Copy link

The shebang must be line 1 of the phar but it mustn't be written to screen.

@Olli
Copy link
Author

Olli commented Feb 10, 2017

The question is why it mustn't be written. From my point of view it's normal php behavior ... the interpreter interprets everything inside of and outputs everything outside of it unchanged.
Is it possible to remove the shebang while creating the phar with pharpiler?

@Olli
Copy link
Author

Olli commented Feb 10, 2017

I did an local installation of nginx and php7.0-fpm ... it works in such way that the shebang is ignored.

@discordier
Copy link

The question is why it mustn't be written.

Because WE do not want to see it (and php-cli does not print it by default).
So we only need to clear it in web environment for which we have the ob_clean() call to clear the shebang from the output in web.

From my point of view it's normal php behavior ... the interpreter interprets everything inside of and outputs everything outside of it unchanged.

In general, you are right on this one. However, there is one exception to this rule, the first line of a script will not be printed from CLI as long as it is a shebang. For php-cgi, fpm, ... it will get written.

Is it possible to remove the shebang while creating the phar with pharpiler?

It would be possible but then not be working anymore by calling ./contao-manager.php.php as the system would not know how to handle the file anymore. That is the reason what the shebang is there for.

I did an local installation of nginx and php7.0-fpm ... it works in such way that the shebang is ignored.

Which it should have been doing all the time, could you pinpoint the other installation why it is not ignored over there?

@Olli
Copy link
Author

Olli commented Feb 20, 2017

Ok I did a local test with my apache and fpm - it works (ok Composer isn't get executed but it's not executed in any other of my test installation).
So I assume it's an all-inkl only problem. That would be fun. :-\

@fritzmg
Copy link
Contributor

fritzmg commented Feb 20, 2017

Would be interesting to find the reason though, as I consider All-Inkl as a Hoster with a good reputation.

@aschempp
Copy link
Member

Please don't worry too much about this stuff in a development build 😉

@discordier
Copy link

Well, this is something that will not change even for the final build. It is the fundamental base.

@Olli
Copy link
Author

Olli commented Feb 21, 2017

It'll be nice if someone can confirm that all-inkl behavior.

@fritzmg
Copy link
Contributor

fritzmg commented Feb 28, 2017

I may be able to test, but someone needs to provide me with the .phar since I cannot build it myself.

@aschempp
Copy link
Member

This is obsolete with the latest version (see https://github.com/contao/contao-manager/tree/develop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants