PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

PHPExcel with cron task ? #1240

Open Krystaal opened 7 years ago

Krystaal commented 7 years ago

Hello,

I have created an Excel file that takes data directly from the database in PHP. Then I save the file on my server and I send it by mail. This works fine when I launch it with my navigator.

My problem is that it doesn't work when the script is launched from a cron task. Does somebody know the reason ? I'm stack here for 2 days and I'm loosing my mind...

Thanks by advance,

Here is the beginning of my script, it if can help :

` require_once 'assets/PHPExcel/Classes/PHPExcel.php'; require_once 'assets/PHPExcel/Classes/PHPExcel/IOFactory.php'; include 'assets/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php';

$classeur->createSheet(); $classeur->setActiveSheetIndex($compteurFeuille); `

robbiedr commented 7 years ago

I need this one for our thesis. Can you please teach me? We also need a cron task.

amjo commented 7 years ago

when coding for Cron jobs, you should include/require the full directory path from the server root...

for example: require_once "/var/www/vhosts/example.com/assets/PHPExcel/Classes/PHPExcel.php";

hope this helps