Привет Паршу лог php - 99% ошибок однострочных, тупо разбираю по новой строчки. А бывают как в данном случае многострочные, когда есть Stack trace. Подскажите пожалуйста, как написать регулярку, чтобы разбить данный текст на три строчки Что я пробовал не получилось Спасибо Код (Text): preg_match_all("/(PHP) (.*) (on line) ([0-9]*)/im", $data, $strRaw, PREG_PATTERN_ORDER); Код (Text): PHP Warning: count(): Parameter must be an array or an object that implements Countable in cron/owner/owner/ownerAdvData/ownerAdvData_ownerAdvImportWhatsapp.php on line 5 PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in api/billing/billingFunc/billingGet_func.php:65 Stack trace: #0 api/billing/billingFunc/billingCorrect_func.php(141): billingGet(Array) #1 cron/user/userBonus/userBonus_billing_billingCorrect.php(36): billingCorrect('1462062', Array) #2 cron/user/userBonus.php(74): require_once('/var/www/a.unir...') #3 {main} thrown in api/billing/billingFunc/billingGet_func.php on line 65 PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php70/lib/php/modules/redis.so' (tried: /opt/php70/lib/php/modules/redis.so (/opt/php70/lib/php/modules/redis.so: cannot open shared object file: No such file or directory), /opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so (/opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Добрый день! Попробуйте сделать так PHP: <? $data = <<<EOF PHP Warning: count(): Parameter must be an array or an object that implements Countable in cron/owner/owner/ownerAdvData/ownerAdvData_ownerAdvImportWhatsapp.php on line 5 PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in api/billing/billingFunc/billingGet_func.php:65 Stack trace: #0 api/billing/billingFunc/billingCorrect_func.php(141): billingGet(Array) #1 cron/user/userBonus/userBonus_billing_billingCorrect.php(36): billingCorrect('1462062', Array) #2 cron/user/userBonus.php(74): require_once('/var/www/a.unir...') #3 {main} thrown in api/billing/billingFunc/billingGet_func.php on line 65 PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php70/lib/php/modules/redis.so' (tried: /opt/php70/lib/php/modules/redis.so (/opt/php70/lib/php/modules/redis.so: cannot open shared object file: No such file or directory), /opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so (/opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 EOF; echo "<pre>"; preg_match_all("/PHP(.*?)on\ line\ \d+/s", $data, $strRaw, PREG_PATTERN_ORDER); print_r($strRaw[0]); /* Array ( [0] => PHP Warning: count(): Parameter must be an array or an object that implements Countable in cron/owner/owner/ownerAdvData/ownerAdvData_ownerAdvImportWhatsapp.php on line 5 [1] => PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in api/billing/billingFunc/billingGet_func.php:65 Stack trace: #0 api/billing/billingFunc/billingCorrect_func.php(141): billingGet(Array) #1 cron/user/userBonus/userBonus_billing_billingCorrect.php(36): billingCorrect('1462062', Array) #2 cron/user/userBonus.php(74): require_once('/var/www/a.unir...') #3 {main} thrown in api/billing/billingFunc/billingGet_func.php on line 65 [2] => PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php70/lib/php/modules/redis.so' (tried: /opt/php70/lib/php/modules/redis.so (/opt/php70/lib/php/modules/redis.so: cannot open shared object file: No such file or directory), /opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so (/opt/php74/lib/php/modules//opt/php70/lib/php/modules/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 ) */ Удачи!
@Vladimir Kheifets, в очередной раз благодарочка, что стараетесь помочь людям, но 1) короткая открывашка "<?" давным-давно в депре; 2) тут всё-таки сначала был более уместен вопрос "зачем парсить лог" )))