{"id":1634,"date":"2022-08-30T15:18:10","date_gmt":"2022-08-30T15:18:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/segmentation-fault-when-running-php-script-from-cli-works-fine-as-cron-job-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:10","modified_gmt":"2022-08-30T15:18:10","slug":"segmentation-fault-when-running-php-script-from-cli-works-fine-as-cron-job-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/segmentation-fault-when-running-php-script-from-cli-works-fine-as-cron-job-collection-of-common-programming-errors\/","title":{"rendered":"Segmentation fault when running PHP script from CLI, works fine as cron job-Collection of common programming errors"},"content":{"rendered":"<p>I have a PHP script that reads a file via <code>fgetcsv<\/code> through PHP&#8217;s <code>zip:\/\/<\/code> wrapper. This works fine locally and when run on production via a cron job. It fails with a Segmentation fault when invoked on production via CLI though, apparently at the end of reading the file when <code>fgetcsv<\/code> returns <code>false<\/code>.<\/p>\n<p>The relevant parts of the script:<\/p>\n<pre><code>#!\/usr\/local\/bin\/php5<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:10:18. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a PHP script that reads a file via fgetcsv through PHP&#8217;s zip:\/\/ wrapper. This works fine locally and when run on production via a cron job. It fails with a Segmentation fault when invoked on production via CLI though, apparently at the end of reading the file when fgetcsv returns false. The relevant [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1634","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1634"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1634\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}