Writing files in Google Cloud using PHP -


so trying write ppt file using php in google cloud app engine.

the final code write file is

$xmlwriter = iofactory::createwriter($phppresentation, "powerpoint2007"); $xmlwriter->save("php://output"); 

it workng in localhost when deploy google cloud gives error err_invalid_response in google chrome , file not found in mozilla firefox.

when accessed logs says

php fatal error:  uncaught exception 'exception' message 'could not close zip file vfs://root/temp/.//phppttmp569a45e921e8a8.63056743.' 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 

after doing research found uncaught exception 'exception' message 'could not close zip file because directory not writable.

can tell me how can make directory in app engine writable?

you cannot. appengine apps doesn't have write access filesystem. docs:

the sandbox isolates application reliability, scalability , security. reason, small number of php functions not available on app engine, , others raise exception if used incorrectly. instance, app cannot write data local file system. instead, apps can use scalable services provided google store , process data , communicate on internet.

(from https://cloud.google.com/appengine/features/)

you have use google cloud storage bucket write files:

<?php file_put_contents('gs://my_bucket/hello.txt', 'hello'); 

there're examples https://cloud.google.com/appengine/docs/php/googlestorage/


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -