Search code examples
cronprestashopcpanel

Running PHP script from cPanel Cronjob


I tried setting up a cronjob from cpanel to run a php script every minute but nothing happens and the logs doesn't show any error. When i run the php script manually everything works fine.

This is the cron command

/usr/local/bin/php /home/alinut/public_html/b2b/parteneri-xml.php > /home/alinut/logs/cron-local.log 2>&1

This are the includes in the script

    include(dirname( __FILE__ ) . '/config/config.inc.php');
    include(dirname( __FILE__ ) . '/init.php');

And this is where it should save an xml

    $domtree->save(dirname( __FILE__ ) . '/xml/test.xml');

Solution

  • I found a solution by using wget

    wget -q https://example.com/parteneri-xml.php