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

require aws.phar fails silently #12

Closed
semiosis opened this Issue Nov 19, 2012 · 6 comments

Comments

Projects
None yet
2 participants
@semiosis

semiosis commented Nov 19, 2012

I am having trouble using the phar file in a trivial script. I have a php script like the one below and when I try to run it from the command line (php script.php) any code after the require 'aws.phar' line does not get executed. It acts like the require aws.phar line was an exit line.

Note: the aws.phar is in the same directory as the script.

<?php
require "aws.phar";
echo "foo\n"; //doesn't execute
@jeremeamia

This comment has been minimized.

Show comment
Hide comment
@jeremeamia

jeremeamia Nov 20, 2012

Contributor

What happens when you turn on errors beforehand? Do you get any error messages?

error_reporting(-1);
ini_set('display_errors', 'on');
require 'aws.phar';

What version of PHP are you using?

Contributor

jeremeamia commented Nov 20, 2012

What happens when you turn on errors beforehand? Do you get any error messages?

error_reporting(-1);
ini_set('display_errors', 'on');
require 'aws.phar';

What version of PHP are you using?

@semiosis

This comment has been minimized.

Show comment
Hide comment
@semiosis

semiosis Nov 20, 2012

Still no errors/output with the extra error reporting stuff.

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)
(ubuntu precise with latest updates)

semiosis commented Nov 20, 2012

Still no errors/output with the extra error reporting stuff.

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)
(ubuntu precise with latest updates)

@jeremeamia

This comment has been minimized.

Show comment
Hide comment
@jeremeamia

jeremeamia Nov 20, 2012

Contributor

Suhosin does not allow phars by default. You need to enable phars specifically. I've not personally done this before, but I've read that you can do it by adding a PHP ini setting to the suhosin.ini (possibly located at /etc/php5/cli/conf.d/suhosin.ini for Ubuntu).

suhosin.executor.include.whitelist = phar

Let me know how that goes.

Contributor

jeremeamia commented Nov 20, 2012

Suhosin does not allow phars by default. You need to enable phars specifically. I've not personally done this before, but I've read that you can do it by adding a PHP ini setting to the suhosin.ini (possibly located at /etc/php5/cli/conf.d/suhosin.ini for Ubuntu).

suhosin.executor.include.whitelist = phar

Let me know how that goes.

@semiosis

This comment has been minimized.

Show comment
Hide comment
@semiosis

semiosis Nov 20, 2012

Success! That worked perfectly. Thank you so much. :D

semiosis commented Nov 20, 2012

Success! That worked perfectly. Thank you so much. :D

@semiosis semiosis closed this Nov 20, 2012

@jeremeamia

This comment has been minimized.

Show comment
Hide comment
@jeremeamia

jeremeamia Nov 20, 2012

Contributor

Thanks for working through that with me. I seems like something we should add to our documentation as well.

Contributor

jeremeamia commented Nov 20, 2012

Thanks for working through that with me. I seems like something we should add to our documentation as well.

@semiosis

This comment has been minimized.

Show comment
Hide comment
@semiosis

semiosis Nov 21, 2012

I should note that I found out this disallowing-phars behavior is a result of my installing the extra php5-suhosin package on top of the basic apache/php packages in ubuntu precise. on a fresh server without the extra php5-suhosin package the phar works right away, without needing any extra ini file settings. Here's the php -v output from the two installs, for reference...

ubuntu with just libapache2-mod-php5:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

ubuntu with libapache2-mod-php5 and optional php5-suhosin package:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

when the optional php5-suhosin package is installed you need to add the ini directive as mentioned above to load the aws.phar.

thanks again & hth

semiosis commented Nov 21, 2012

I should note that I found out this disallowing-phars behavior is a result of my installing the extra php5-suhosin package on top of the basic apache/php packages in ubuntu precise. on a fresh server without the extra php5-suhosin package the phar works right away, without needing any extra ini file settings. Here's the php -v output from the two installs, for reference...

ubuntu with just libapache2-mod-php5:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

ubuntu with libapache2-mod-php5 and optional php5-suhosin package:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

when the optional php5-suhosin package is installed you need to add the ini directive as mentioned above to load the aws.phar.

thanks again & hth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment