Avatar of Kvapka Kvapla
Kvapka Kvapla
 asked on

com_exception when sending message (<2MB) to MSMQ using PHP

I'm trying to send messages to MSMQ using PHP. When the message is smaller than approximately 1.1 MB the message is sent. Otherwise, I get exception "com_exception: There are insufficient resources to perform this operation." The message is smaller than the limit 4 MB. This is what I've found out so far:

- file_get_contents and file_put_contents with PHP works with no problem, so upload limit should be fine
- sending same message not with php works with no problem, so it is somehow PHP-related
- purging messages from queue does not help
- no dead-letter messages

php.ini settings:

upload_max_filesize=20M
memory_limit=512M

There is no limit on message size in msmq properties.
Chat / IM* MsmqPHP

Avatar of undefined
Last Comment
NerdsOfTech

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gr8gonzo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Kvapka Kvapla

ASKER
Thank you very much for your response and detailed explanation. The messages has sometimes more then 2-million characters indeed. I'd like to set message encoding to ASCII - I'd do base64 encoding and then it should be fine to send it as ASCII. The problem is that I haven't find a way to set MSMQ message encoding to ASCII in PHP.
 For C# you can set the encoding. I've tried to get all the variables for the COM class like this

 $oExplorer = new COM("MSMQ.MSMQMessage");
        com_print_typeinfo($oExplorer, 'IMSMQMessage4');

Open in new window


But there is no such attribute as
BodyEncoding

Open in new window

. Do you think there is any way how to achieve it?
SOLUTION
NerdsOfTech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
gr8gonzo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
NerdsOfTech

Encoding issue can be resolved using gr8gonzo's solution; assist points for BASE64 explanation.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck