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

PPT is not working when uploaded the Google Cloud #170

Closed
pranshuagrawal opened this issue Jan 16, 2016 · 10 comments
Closed

PPT is not working when uploaded the Google Cloud #170

pranshuagrawal opened this issue Jan 16, 2016 · 10 comments
Milestone

Comments

@pranshuagrawal
Copy link

So I made a PPT using PPTPowerpoint, the code is working absolutely fine on my localhost but when i try deploying it to Google Cloud, it doesn't responds. What I mean by it doesn't respond is

  1. On chrome: It is giving ERR_INVALID_RESPONSE
  2. On Firefox: It is giving File Not Found.

My GC is correctly configured to serve PHP files (though not sure do I need to firther configure it to support PPTX or not).

Does any one else has faced this issue, Any work around for this?

@pranshuagrawal
Copy link
Author

The exact error which i can see in my Logs is:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Could not close zip file vfs://root/temp/.//phppttmp569a3ebe8e10c9.36645304.' in /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/src/PhpPresentation/Writer/PowerPoint2007.php:320

Stack trace:

0 /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/samples/Sample_Header.php(72): PhpOffice\PhpPresentation\Writer\PowerPoint2007->save('php://output')

1 /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/samples/scout_temp.php(381): write(Object(PhpOffice\PhpPresentation\PhpPresentation), 'scout_temp', Array)

2 {main}
  thrown in /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/src/PhpPresentation/Writer/PowerPoint2007.php on line 320

@Progi1984
Copy link
Member

@pranshuagrawal Are you writing in a directory where you have writing rights ?

@pranshuagrawal
Copy link
Author

So in Google App Engine, we are required to write to buckets. We do not have write permission to the file system. So creating a file should be something like this:
file_put_contents('gs://bucket_name/app_name');

However, the save() function in PowerPoint2007.php is looking for a different directory path. When I log this path out it shows me: my/file/system/htdocs/gs:/bucket_name/app_name.

How do I get this to work on App Engine, any idea?

@Progi1984
Copy link
Member

@pranshuagrawal I never use AppEngine, so I improvise.

Could you show me the code for saving the file ? (with content of variables) Thanks

@pranshuagrawal
Copy link
Author

I am using two variants and none of them is working.
1.

$xmlWriter = IOFactory::createWriter($phpPresentation, "PowerPoint2007");
$xmlWriter->save("php://output");
return;
$xmlWriter = IOFactory::createWriter($phpPresentation, "PowerPoint2007");
$xmlWriter->save("gs://bucket_name/app_name");
return;

and none of them is working, the error is same in both the cases and it is Could not close zip file.

@Progi1984
Copy link
Member

Try this :

ob_start();
$pptxWriter = IOFactory::createWriter($phpPresentation, "PowerPoint2007");
$pptxWriter->save("php://output");
$output = ob_get_contents();
ob_end_clean();

file_put_contents('gs://bucket_name/app_name', $output);

@Progi1984
Copy link
Member

Some news ?

@pranshuagrawal
Copy link
Author

So the issue was that App Engine does not have Zip Extension installed and we can not help it sadly. So I moved my PPT Export module to compute engine of GC which is nothing but a Linux VM, and now it is working great there.

Thanks for being so active here.

@Progi1984
Copy link
Member

@pranshuagrawal I'm going to implement adapters for Zip : ZipArchive if installed or PclZip if not...

@Progi1984 Progi1984 added this to the 0.7.0 milestone Jan 27, 2016
@Progi1984
Copy link
Member

Linked to #176

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

No branches or pull requests

2 participants