{"id":91,"date":"2017-12-29T20:18:48","date_gmt":"2017-12-29T18:18:48","guid":{"rendered":"https:\/\/lyubomir-angelov.com\/?p=91"},"modified":"2020-02-09T19:28:38","modified_gmt":"2020-02-09T17:28:38","slug":"php-soapclient-gives-error-500-cannot-catch-error","status":"publish","type":"post","link":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/","title":{"rendered":"PHP SoapClient() gives error 500 and cannot catch the error"},"content":{"rendered":"<p>Went to an error 500 in production server while using PHP SoapClient library to connect to some third-party API. The error was really strange, just error 500 and nothing more, even if you are using try catch, you won&#8217;t be able to catch and see the error.<br \/>\n<!--more--><br \/>\nThe Example:<\/p>\n<pre class=\"language-php\"><code>\ntry{\n    $client = new SoapClient(&quot;https:\/\/api.thirdparty.com\/some\/service?wsdl&quot;, [&#039;exceptions&#039; =&gt; true, &#039;trace&#039; =&gt; true]);\n} catch(SoapFault $fault) {\n    trigger_error(&quot;SOAP Fault: (faultcode: &quot; . $fault-&gt;faultcode . &quot;, faultstring: &quot; . $fault-&gt;faultstring . &quot;)&quot;, E_USER_ERROR);\n} catch(Exception $e) {\n    trigger_error(&quot;SOAP Error: &quot; . $e-&gt;getMessage(), E_USER_ERROR);\n}\n<\/code><\/pre>\n<p><!--more--><\/p>\n<p>Even with this, the error 500 will appear and won&#8217;t be caught.<\/p>\n<p>The problem of the SoapClient is that his temporary files are messed up somehow, maybe the PHP version was upgraded or maybe the \/tmp dir was full on production and the server was not able to create new ones but yes, this is the problem.<\/p>\n<p>So, the solution is simple, just delete all files from <strong>\/tmp<\/strong> directory on the server that are starting with <strong>&#8220;wsdl-&#8220;<\/strong> and the error will disappear.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Went to an error 500 in production server while using PHP SoapClient library to connect to some third-party API. The error was really strange, just error 500 and nothing more, even if you are using try catch, you won&#8217;t be able to catch and see the error.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14,15],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-php","tag-soap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov\" \/>\n<meta property=\"og:description\" content=\"Went to an error 500 in production server while using PHP SoapClient library to connect to some third-party API. The error was really strange, just error 500 and nothing more, even if you are using try catch, you won&#8217;t be able to catch and see the error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\" \/>\n<meta property=\"og:site_name\" content=\"Lyubomir Angelov\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-29T18:18:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-09T17:28:38+00:00\" \/>\n<meta name=\"author\" content=\"Lyubomir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@angelovcode\" \/>\n<meta name=\"twitter:site\" content=\"@angelovcode\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lyubomir\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\"},\"author\":{\"name\":\"Lyubomir\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"headline\":\"PHP SoapClient() gives error 500 and cannot catch the error\",\"datePublished\":\"2017-12-29T18:18:48+00:00\",\"dateModified\":\"2020-02-09T17:28:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\"},\"wordCount\":139,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"keywords\":[\"php\",\"soap\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\",\"name\":\"PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov\",\"isPartOf\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\"},\"datePublished\":\"2017-12-29T18:18:48+00:00\",\"dateModified\":\"2020-02-09T17:28:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lyubomir-angelov.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP SoapClient() gives error 500 and cannot catch the error\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/\",\"name\":\"Lyubomir Angelov\",\"description\":\"The life of a Manager\",\"publisher\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\",\"name\":\"Lyubomir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"caption\":\"Lyubomir\"},\"logo\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/angelovcode\"],\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/author\/superfly\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/","og_locale":"en_US","og_type":"article","og_title":"PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov","og_description":"Went to an error 500 in production server while using PHP SoapClient library to connect to some third-party API. The error was really strange, just error 500 and nothing more, even if you are using try catch, you won&#8217;t be able to catch and see the error.","og_url":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/","og_site_name":"Lyubomir Angelov","article_published_time":"2017-12-29T18:18:48+00:00","article_modified_time":"2020-02-09T17:28:38+00:00","author":"Lyubomir","twitter_card":"summary_large_image","twitter_creator":"@angelovcode","twitter_site":"@angelovcode","twitter_misc":{"Written by":"Lyubomir","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#article","isPartOf":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/"},"author":{"name":"Lyubomir","@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"headline":"PHP SoapClient() gives error 500 and cannot catch the error","datePublished":"2017-12-29T18:18:48+00:00","dateModified":"2020-02-09T17:28:38+00:00","mainEntityOfPage":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/"},"wordCount":139,"commentCount":0,"publisher":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"keywords":["php","soap"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/","url":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/","name":"PHP SoapClient() gives error 500 and cannot catch the error - Lyubomir Angelov","isPartOf":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#website"},"datePublished":"2017-12-29T18:18:48+00:00","dateModified":"2020-02-09T17:28:38+00:00","breadcrumb":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/lyubomir-angelov.com\/blog\/php-soapclient-gives-error-500-cannot-catch-error\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lyubomir-angelov.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PHP SoapClient() gives error 500 and cannot catch the error"}]},{"@type":"WebSite","@id":"https:\/\/lyubomir-angelov.com\/blog\/#website","url":"https:\/\/lyubomir-angelov.com\/blog\/","name":"Lyubomir Angelov","description":"The life of a Manager","publisher":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92","name":"Lyubomir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","caption":"Lyubomir"},"logo":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/twitter.com\/angelovcode"],"url":"https:\/\/lyubomir-angelov.com\/blog\/author\/superfly\/"}]}},"_links":{"self":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/comments?post=91"}],"version-history":[{"count":3,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}