Parse error: syntax error, unexpected 'version' (T_STRING) in /home/xxx/public_html/ojs/plugins/generic/usageStats/scheduledTasks.xml on line 1

Dear all,

We have an issue that the statistic article does not show any count since 25 Dec '20. I have tried everything to solve the issue (using acron, using cron, moving logfiles to stage folder) but it did not solve the problem.

Tonight, I am trying to use Cron again as it states here Statistics (sfu.ca), and the Cron job massage is “Parse error: syntax error, unexpected ‘version’ (T_STRING) in /home/adeputra23/public_html/myjurnal/plugins/generic/usageStats/scheduledTasks.xml on line 1”, the error_log did not record any about this eror.

Any further advice?

Thank you so much!

What version of OJS/OMP/OPS are you using?

We are using OJS v 3.2 November 2020

Maybe server settings affecting this: indexing - Parse error: syntax error, unexpected T_STRING with index.php? - Stack Overflow

short_open_tag

What command line are you using for cron? It sounds as if you are trying:

php plugins/generic/usageStats/scheduledTasks.xml

with short_tag_open enabled, when this should be:

php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml

With a correctly formulated PHP command line (or PHP web bindings, if folks see this outside of the command line), the short_tag_open option shouldn’t matter.

I used the first code php plugins/generic/usageStats/scheduledTasks.xml

I have tried to change the short_tag_open in php.ini and then run the Cron command. Cron job sent this report
<?xml version="1.0" encoding="UTF-8"?>

<scheduled_tasks>

Extract transform and load usage statistics data into database.

</scheduled_tasks>

Now, I am waiting for the stats to come.

Thank you

The first form of the command (running php against the xml) is incorrect.

You must run the php command against the runScheduledTasks.php script, with the xml file as the first parameter (second form of the command):

php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml

Yes, I’ve follow the command above…
IMG_20210120_221917

And here is the report

Screenshot_20210120_221943

Thank you so much …

Now I am checking the ScheduledTaskLogs folder for the last log that appearing the statistic (26 Dec 2020). Here is the result

[2020-12-25 20:32:14] https://myjurnal.poltekkes-kdi.ac.id
[2020-12-25 20:32:14] [Notice] Task process started.
[2020-12-25 20:32:17] [Error] Error: can’t execute “”. Check your gzip setting in config.inc.php.
[2020-12-25 20:32:17] [Notice] File /home/adeputra23/myjurnal/usageStats/processing/usage_events_20201224.log was processed and archived.
[2020-12-25 20:32:17] [Notice] Task process stopped.

Then, from the same folder, I checked for most-viewed log
[2021-01-14 02:27:52] JURNAL ONLINE POLTEKKES KEMENKES KENDARI
[2021-01-14 02:27:52] [Notice] Task process started.

image

Here is the screenshot from the usage stats folder

And the Article stats stopped work since 25 Dec 2020

image

You are still missing the “tools/runScheduledTasks.php” component in your second cron.

The output you are seeing is not a report, but the content of the XML file run through the PHP processor (which hasn’t done anything).

If used, your second cron job should be:

/usr/local/bin/php /home/adeputra23/public_html/{your_dir}/tools/runScheduledTasks.php /home/adeputra23/public_html/{your_dir}/plugins/generic/usageStats/scheduledTasks.xml

Also note that both of these are running every minute, which is more frequently than necessary.

On the other hand, seeing scheduledTaskLogs entries such as:

[2020-12-25 20:32:17] [Notice] File /home/adeputra23/myjurnal/usageStats/processing/usage_events_20201224.log was processed and archived.

suggests that something is running (or was previously running) the usage statistics task. This is likely the “acron” plugin. Do you have that plugin enabled?

The error:

[2020-12-25 20:32:17] [Error] Error: can’t execute “”. Check your gzip setting in config.inc.php.

Suggests that you are missing this setting in config.inc.php, in the [cli] section:

; gzip
gzip = /bin/gzip

This would need to point to the correct path to this “gzip” executable on your server.

I found this from error_log, this since the Article Stats did not display any count

[24-Dec-2020 20:27:36 UTC] PHP Deprecated:  Non-static method Core::removeBaseUrl() should not be called statically in /home/adeputra23/public_html/myjurnal/plugins/generic/usageStats/UsageStatsLoader.inc.php on line 767

[24-Dec-2020 20:27:36 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/adeputra23/public_html/myjurnal/lib/pkp/classes/core/Core.inc.php on line 231

Update from Cron task, there is no report to the email…

Dear community, I have applied a solution to this problem.
I did these ways:

  1. Turning the PHP settings to default;
  2. Enabled the Acron plugin
  3. Applying the Cronjob for usageStats using this code
    /usr/local/bin/php /home/journal/public_html/{your_dir}/tools/runScheduledTasks.php /home/journal/public_html/{your_dir}/plugins/generic/usageStats/scheduledTasks.xml
  4. Move the files from the Stats folder to Stage every day

Thank you