0

(sorry for my english)

Im creating an online form that upon submission take all the data,create zip file (using ZIPArchive) and send email with all the data and included zip file. When i run the php script , it works just fine and zip file is attached to the mail.

problem starts when i use CRON to run the script.. The cron log file had this error:

Failure to create temporary file: Permission denied

so i need to add permissions to my cron file in order for the $zip->close() commend to work(i guess). that is the problematic commend.

I have no idea how im new to cron .

Im using openshift and i put my cron file in repo/.openshift/cron/minutely/cronSend.sh and as i said it works when i run it manually. thats the cron file:

php $OPENSHIFT_REPO_DIR/finSend.php

here is the php:

$res = $zip->close();
if ($res  !== true ){
   echo 'failed to close zip !! <br/>';die($zip->getStatusString()."\n")
;}
am am
  • 21
  • 1
  • 8

2 Answers2

0

does the user that CRON uses to create the file, has permissions to access the specified folder? is the root user or someone else?

makoulis
  • 33
  • 5
  • im not sure i understand (beginner), i use it and its supposed to create the zip in my repo folder – am am Sep 20 '16 at 13:15
  • Cron is a program, and a user is called to do a job at specific time. Does this user that executes the php code in cron, have permissions to read and write in the folder that the zip will be created? – makoulis Sep 20 '16 at 13:24
  • in the filezilla permissions give read write execute..tick all boxes – makoulis Sep 20 '16 at 13:27
  • and if i understand you right i am the user and ive uploaded and used the repo folder freely – am am Sep 20 '16 at 13:29
  • do ineed to do some restart or somthing? the log files still says "Failure to create temporary file: Permission denied" – am am Sep 20 '16 at 13:32
  • refresh the folder or restart the server if this doesn't work – makoulis Sep 20 '16 at 13:34
  • dident work either ... thats the last part of my project i need to get it to work.. – am am Sep 20 '16 at 13:39
-1

assign permission to the folder where zip file is created

  • i dont know how, im using fillzila and if i right click on the folder it gives permmisions options, ill update.. – am am Sep 20 '16 at 13:25