Cloud Stack Ninja

I am beginning level user of Php/ Mysql etc, currently trying to make a web application on a GCP server running on Debian and lamp. The application draws data from Mysql database and fill fields of editable PDF and save completed pdf in a separate folder. It runs fine on my windows PC (with xampp) but when i run it on the server- "failed- no file" message pops up with no pdf file being generated. However the void pdf file comes with the correct file name though.

Here is the code being used- can you please look into it. TIA.

namespace classes;

if(!defined('ACCESSCHECK')) {
      die('Direct access not permitted');

use mikehaertl\pdftk\Pdf;
class GeneratePDF_nsc {
           public function generate($data)
                  try {
                        $filename = 'nsc_' .  rand(0001,1000) . '.pdf';      //  Name of the filled-in pdf file
                        $security= "nsc";
                        $pdf = new Pdf('/var/www/html/forms/'.$security.'.pdf');      
                        ->saveAs( '/var/www/html/completed/' .$filename);
                        return $filename;
                  catch (Exception $e)
                        return $e->getMessage();

Regards, AI

Read more here:

Content Attribution

This content was originally published by Ali at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: