Division by zero error
Hello, I am having some trouble with the CLI export. It was working previously but recently started throwing errors.
PHP Notice: Uninitialized string offset: 0 in /var/www/html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/HTMLProcessor.php on line 2
This message spams, I think it repeats for each file being exported. This was resolved by upgrading to PHP7.2
The remaining issue is:
PHP Warning: Division by zero in /var/www/html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ProgressLog.php on line 2
Warning: Division by zero in /var/www/html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ProgressLog.php on line 2
This error is printed twice and the export folder remains empty. What would cause this?
- 5 replies
- Leon Stafford @leonstafford2019-02-13 23:16:46.167Z
Glad you got those other issues sorted. Something may have gone a bit weird throughout the process. To start with a clean slate, please delete any files in your wp-content/uploads/ directory starting with WP or wp-* that belong to the plugin.
Delete your deploy cache (Advanced tab).
If the deploy doesn't go through, please enable Debug Mode in Advanced Tab, re-run and see if you're getting any errors in the Export Log (Logs tab).
Thanks for that, I think I was suppressing some of the errors. I cleared out the files you mentioned and have also reset the defaults, here's a snip of what spams when I run the export:https://pastebin.com/TbhsMv1x
It appears there may be a problem with too many files being open, doing some debug to see about increasing that limit, will update with new findings.
I updated the file limits to 10k/100k using the instructions here: http://posidev.com/blog/2009/06/04/set-ulimit-parameters-on-ubuntu/ (they're from 2009 but did the job) and restarted, it appears to be working now. Interesting, about to test my deploy script to see if it's working properly now.
Script ran without any errors, re-enabled cron as it appears to be settled now.
- In reply tograhamJenkins⬆:Leon Stafford @leonstafford2019-02-14 00:10:59.679Z
The too many files open can be a tricky one to debug: https://github.com/leonstafford/wp2static/issues/197
If you enter
ulimit -n 10000before running WP-CLI generate, it may work for you.
I also added the Crawl Delay in the Crawl tab, which seemed to work on one of my test systems, as if it gave enough time for cleanup to happen.
Hope that helps!
- Leon Stafford @leonstafford2019-02-14 00:12:51.761Z
If nginx, this section may also be worth checking:
nginx worker_rlimit_nofile Option (Increase Open FD Limit at Nginx Level)https://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/