The below code works perfect on XAMPP on my PC, but does not work on my newly bought VPS. It crashed my code.
preg_match_all( "/$regex/siU" , $string , $matches , PREG_SET_ORDER );
This is expected to simply fetch links and titles from HTML.
Previously, a similar regex problem occurred today. Code was running fine on local server, but creating "Connection Was Reset" error on vps. The problem was caused by some commented html (having php code inside it) that was removed using the below code to optimize output, but even the problem of connection reset is resolved, HTML still has comments in browser source.
$string = preg_replace( '/<!--(.|\s)*?-->/' , '' , $string );
So, problem is clear. These regex functions are not working fine. But i do not know the solution.
Can anyony help me in solving this.
Solved:
Thanks to https://stackoverflow.com/a/12761686/369005 @vimishor