Jump to content

Recommended Posts

Hi,

 

I have a php script that is meant to run daily which queries an oracle database and stores results in a csv file before emailing it to certain users. However when run on crontab or even manually the script is killed by the system. Has anyone got any suggestions on where i would need to look to check for error logs. Emails are sent using the mail php class. Also the data attached in the email is usually around 12mb.

 

Many thanks.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/247891-php-script-on-crontab/
Share on other sites

PHP has memory limits and sometimes the CLI and webserver configurations may be setup differently, but you'd probably error out the script running it manually, and I'll assume you've already checked PHPs error_log.  You could be using too much system memory (imposed through ulimit), if its the system try syslog, usually /var/log/messages or somewhere under /var, if you're sending through a local mailer try /var/log/mail.log or again something similar under /var.  If you're connecting to a remote mail server you're going to have to develop or use a more sophisticated mail class to recognize errors from the server as the mail function only returns a boolean.

Just had a look at the logs all seem normal or dont tell much apart from the syslog. This is the error message on there at the time where crontab is meant to run this script:

 

 

Sep 27 09:50:48 IT kernel: [1726073.814062] php invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0
Sep 27 09:50:48 IT kernel: [1726073.814137] php cpuset=/ mems_allowed=0
Sep 27 09:50:48 IT kernel: [1726073.814160] Pid: 979, comm: php Not tainted 2.6.32-30-generic #59-Ubuntu
Sep 27 09:50:48 IT kernel: [1726073.814182] Call Trace:
Sep 27 09:50:48 IT kernel: [1726073.814291]  [<c01ce494>] oom_kill_process+0xa4/0x2b0
Sep 27 09:50:48 IT kernel: [1726073.814304]  [<c01ceb09>] ? select_bad_process+0xa9/0xe0
Sep 27 09:50:48 IT kernel: [1726073.814310]  [<c01ceb91>] __out_of_memory+0x51/0xa0
Sep 27 09:50:48 IT kernel: [1726073.814316]  [<c01cec38>] out_of_memory+0x58/0xb0
Sep 27 09:50:48 IT kernel: [1726073.814322]  [<c01d1517>] __alloc_pages_slowpath+0x487/0x4a0
Sep 27 09:50:48 IT kernel: [1726073.814329]  [<c01d166a>] __alloc_pages_nodemask+0x13a/0x170
Sep 27 09:50:48 IT kernel: [1726073.814336]  [<c01d3c2a>] __do_page_cache_readahead+0xea/0x200
Sep 27 09:50:48 IT kernel: [1726073.814342]  [<c01d3d66>] ra_submit+0x26/0x30
Sep 27 09:50:48 IT kernel: [1726073.814348]  [<c01ccf0c>] filemap_fault+0x3dc/0x410
Sep 27 09:50:48 IT kernel: [1726073.814373]  [<c01e6440>] __do_fault+0x40/0x490
Sep 27 09:50:48 IT kernel: [1726073.814380]  [<c01d4a51>] ? lru_cache_add_lru+0x21/0x40
Sep 27 09:50:48 IT kernel: [1726073.814387]  [<c01ef024>] ? page_add_new_anon_rmap+0x64/0x70
Sep 27 09:50:48 IT kernel: [1726073.814393]  [<c01e80a9>] handle_mm_fault+0x139/0x390
Sep 27 09:50:48 IT kernel: [1726073.814471]  [<c05918cd>] do_page_fault+0x10d/0x3a0
Sep 27 09:50:48 IT kernel: [1726073.814496]  [<c05917c0>] ? do_page_fault+0x0/0x3a0
Sep 27 09:50:48 IT kernel: [1726073.814502]  [<c058f7c3>] error_code+0x73/0x80
Sep 27 09:50:48 IT kernel: [1726073.814513] Mem-Info:

 

I will increase the ulimit of my user account its currently at 1024.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.