Mbstring problem

I want to turn on or setup mbstring in my host, how can i do it ?

there is no way to alter the php configuration on free hosting


It’s enabled already


Go to the control panel and click on “Alter PHP Config”?


When I enter alter php, I see that only mbstring is in auto and there is no other option.

‘Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of string type, given in CurlHandle’ they say that this problem may be caused by mbstring not being active ?

Can you share your website’s URL where this issue is displayed?


It seems to me that the second argument to the preg_match function should be a string, but isn’t. As to why that happens, it’s hard to tell.

Can you please provide more information? Things that would help include:

  • The account username and/or domain on which you experience this issue.
  • The full error message (what you’re sharing here appears to be cut off).
  • The code where this error occurs (should be shown as part of the error message).
  • Who says that that this may be mbstring related and where and how do they say this.

Maybe this is related to mbstring, maybe it isn’t. But the information you’ve shared so far doesn’t have anything to do with mbstring, so I don’t know.


metinsah.rf.gd the error is on index and also before I got this error this code was working fine here and even this code is running successfully on my ‘localhost’

I see this error:

Fatal error : Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, CurlHandle given

Are you running PHP 7.4 on localhost? If so, perhaps your code was affected by a change in PHP 8, where curl handler resources were replaced with class objects:

What exactly are you trying to pass to the function? Can you share your code (removing any potentially sensitive parts)?


i am using php 5.6 on my localhost which version is php on localhost i dont now but I want to get specific html line with curl i think i will use the Php Curl Class on my script thank you for help If you have an idea I can try for this problem, I would like to try it. Thanks.

second one is not localhost ı mean this hosting php version.

Hi Bilocan,

preg_match has nothing to do with PHP versions whatsoever, it’s a regular expression function, and you might have accidentally passed in a CurlHandle into the function. Would you please share your code and we can see from there? Remember to hide all credentials or API keys if needed.

If you intend to have the response text to be matched, you’re looking for something like this:

$output = curl_exec($ch);
// some checking to see if it actually comes back 200 OK
preg_match('/(\d+)/', $output, $matches); // match all numbers, replace with your own regex.



Thank you for answer.
here is my code lines.

$ch_index = curl_init();
curl_setopt($ch_index, CURLOPT_URL, 'url');
curl_setopt($ch_index, CURLOPT_REFERER, 'url');
//curl_setopt($ch_index, CURLOPT_TIMEOUT, 10);
curl_setopt($ch_index, CURLOPT_PROXYPORT, $proxy_port);
curl_setopt($ch_index, CURLOPT_PROXYTYPE, 'HTTP');
curl_setopt($ch_index, CURLOPT_PROXY, $proxy_ip);
curl_setopt($ch_index, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch_index, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch_index, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_index, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch_index, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch_index, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch_index, CURLOPT_VERBOSE,true);
curl_setopt($ch_index, CURLINFO_HEADER_OUT, true);
curl_setopt($ch_index, CURLOPT_ENCODING	, "gzip");
curl_setopt($ch_index, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/117.0.2045.47");
$headers = [
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
	'Accept-Language: tr,en;q=0.9,en-GB;q=0.8,en-US;q=0.7',
	'Content-Type: text/html; charset=UTF-8',
$curl_output = curl_close($ch_index);
// Veriyi parçalama işlemi
preg_match('@<div id="rank-player" (.*?)>(.*?)</div>@si',$ch_index,$parcel_player);
preg_match('@<div id="rank-guild" (.*?)>(.*?)</div>@si',$ch_index,$parcel_guild);
preg_match('@<div class="unique-times">(.*?)</div>@si',$ch_index,$parcel_time);
$parcel_player = $parcel_player[0];
$parcel_guild = $parcel_guild[0];
$parcel_time = $parcel_time[0];

by the way this code was work this host about a yer ago and it still work on my localhost.

You don’t seem to be executing the session anywhere in your code; I believe you should replace curl_close with curl_exec: PHP: curl_exec - Manual

curl_close returns nothing: PHP: curl_close - Manual

I also think you mean to use preg_match on $curl_output, not on the $ch_index which is automatically deleted when you call curl_close according to the documentation. I’m surprised this code is working for you in localhost.

This is how I’m thinking it:

$curl_output = curl_exec($ch_index);
// Veriyi parçalama işlemi
preg_match('@<div id="rank-player" (.*?)>(.*?)</div>@si',$curl_output,$parcel_player);
preg_match('@<div id="rank-guild" (.*?)>(.*?)</div>@si',$curl_output,$parcel_guild);
preg_match('@<div class="unique-times">(.*?)</div>@si',$curl_output,$parcel_time);
$parcel_player = $parcel_player[0];
$parcel_guild = $parcel_guild[0];
$parcel_time = $parcel_time[0];

Hahaha. Omg bro I feel stupid really.
I’m still laughing at how I made this mistake
Thank your for all hepls.you did handle me


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.