I have a page that adds items to a DB table and creates a new txt file with those items. It works fine when I run it manually but when it runs as a CRON in Plesk I get
PHP Warning: fopen(file.txt): failed to open stream: Permission denied
PHP Warning: fwrite(): supplied argument is not a valid stream resource
the cron is running under the domain in Plesk, not the Server and the syntax is:
/usr/bin/php -f /var/www/vhosts/*.com/subdomains/dev/httpdocs/crons/file.php
When the cron runs and gets the errors it still adds the items to the DB table but, obviously, doesn't creates the txt file.
I added the cron to a site using cpanel and it worked fine. Could it be a plesk user problem? I tried running the cron under apache in plesk and still get the same error. Tried running it as user root in SSH and still nothing.
Also, the file and folder are set to 777