tschoffelen / php-pkpass

💳 PHP class for creating passes for Wallet on iOS.
https://includable.com
MIT License
916 stars 187 forks source link

Empty .pkpass files #54

Closed jskidd3 closed 8 years ago

jskidd3 commented 8 years ago

Whenever I run examples/example.php all that is exported is an empty .pkpass file. I have spent many hours reading through very carefully and started over several times but cannot get this library to work. Can anyone please shed light on why this is happening?

I have set paths, permissions, ownership etc on all of the required files as well as ensured that all variables (eg team ID, pass ID etc) are set.

tschoffelen commented 8 years ago

Try adding the following lines at the top of example.php (after the <?php):

ini_set('display_errors',1);
error_reporting(E_ALL);

And see if it outputs any errors. If it does, post it here, than I might be able to help you with this specific case.

jskidd3 commented 8 years ago

I tried running the script with root using the command line with php example.php > example.pkpass and this produced the pass correctly.

That must mean this is a permission issue, right? Accessing example.php from the URL creates an empty pass. Thanks - appreciate your help with this.

jskidd3 commented 8 years ago

After further investigation, in the create method if I dump the file to the server, file_put_contents('test.pkpass', $file);, then the pass is valid (33,340 bytes). However, when create reaches echo $file;, it just downloads an empty pass to the browser.

wayneworks commented 8 years ago

Joel,

I had the same problem a month ago with creating a pass. It ended up being something in the class file that was deleting the file too fast. I ended up commenting out the unlink command then my pass started working perfectly.

On Jul 22, 2016, at 8:06 PM, Joel notifications@github.com<mailto:notifications@github.com> wrote:

I tried running the script with root using the command line with php example.php > example.pkpass and this produced the pass correctly.

That must mean this is a permission issue, right? Thanks - appreciate your help with this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/tschoffelen/PHP-PKPass/issues/54#issuecomment-234685093, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFsUlaABOYAOHolPTarSVEAXdOjbAMFdks5qYVrsgaJpZM4JSNiJ.

jskidd3 commented 8 years ago

@wayneworks That fixed the problem! Thanks so much :smiley:

tschoffelen commented 8 years ago

@jskidd3, would you mind opening a pull request with the changes you made? Might be useful for others as well. Thanks!

wayneworks commented 8 years ago

no problem glad that helped.

On Jul 23, 2016, at 6:48 AM, Joel notifications@github.com<mailto:notifications@github.com> wrote:

@wayneworkshttps://github.com/wayneworks That fixed the problem! Thanks so much 😃

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tschoffelen/PHP-PKPass/issues/54#issuecomment-234712050, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFsUlaSY99WjHwYEmqz74ZlRbIw6yJ-dks5qYfGPgaJpZM4JSNiJ.

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.