0

I am new to cron and I need all of your help , when I am using cron job to create folder and download images in that folder cron page giving me error that :

PHP Warning:  imagejpeg(): Unable to open '././../uploads/lmf-classifieds-pk/folder2/2013-04-05/36258/1365138829_498747097_3-Khyber-1990-Urgent-sale-Islamabad.jpg' for writing: No such file or directory in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/function.php on line 143
PHP Notice:  Undefined offset: 1 in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/olx_extract.php on line 562
PHP Warning:  mkdir(): Permission denied in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/function.php on line 61
PHP Warning:  mkdir(): Permission denied in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/function.php on line 65
PHP Warning:  mkdir(): Permission denied in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/function.php on line 69
PHP Warning:  mkdir(): No such file or directory in /var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/cron_lmf/function.php on line 90

From these error .. I can understand cron job (page) is unable to create folder as well as download image .... Because of permission...

What should I need to do in this can ?

Please help me.

Stephan Branczyk
  • 9,363
  • 2
  • 33
  • 49

1 Answers1

0

It looks like your script doesn't have the necessary permissions to do a mkdir on that folder, check that you have write access.

gmaliar
  • 5,294
  • 1
  • 28
  • 36
  • I think for this i need to make folder permission 777 that i did if there is some thing other need to do ? please help me (guide me ) for that. – M Shahzad Akram Apr 11 '13 at 10:53
  • Do you give your imagejpeg the right path then? Do you use `dirname(__FILE__)` to get the path of the current script and then move onto `../../uploads` etc. ? – gmaliar Apr 11 '13 at 10:55
  • I don't think this is exactly the problem but make sure you have +x set on all the directories upto the final directory. I'm mainly saying this because of the last warning. – Sanchit Apr 11 '13 at 11:06
  • I am using now complete path like this : var/www/vhosts/ip-50-62-136-81.ip.secureserver.net/lmf_this/uploads/ and still problem ... when i am accessing folder by browser it created folder but when i am using via cron its not going to create folder ,,,, – M Shahzad Akram Apr 11 '13 at 14:00
  • Perhaps your cron user doesn't have permission either, check this out, it might be of help. http://stackoverflow.com/questions/10831785/permission-denied-mkdir-for-cron-and-browser – gmaliar Apr 11 '13 at 14:06