Ghostscript is not working with imagick error FailedToExecuteCommand

I have PHP Laravel script working with following configuration.

Laragon
Apache httpd-2.4.54-win64-VS16
PHP 8.3
Ghostscript 10.04.0
ImageMagick 7.1.0-18 Q16 x64

When I tried to convert pdf into image using exec command it works.

$pdfPath = $cvFile;
$outputPath = 'd:/temp/test.png';
$gsCommand = "gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r144 -sOutputFile="$outputPath" "$pdfPath"";
exec($gsCommand, $output, $returnCode);

But it doesn’t works when I tried to convert pdf using Imagick().

$imagick = new Imagick();
$imagick->readImage($cvFile);

I got this error when I tried the execute the above code on line readImage().

FailedToExecuteCommand `”gs” -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pngalpha” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72” -dPrinted=false “-sOutputFile=C:/Users/alish/AppData/Local/Temp/magick-fzsvjp49WgV_dLqdzA-KMiGFzpNpmnvQ%d” “-fC:/Users/alish/AppData/Local/Temp/magick-dC4PEbPqgCO7mlsy_cDaOIWgVTrR6Ixu” “-fC:/Users/alish/AppData/Local/Temp/magick-EJa1tcrtqJ9dcGUOrY2gv7–rqFtZS21″‘ (The system cannot find the file specified. ) @ error/delegate.c/ExternalDelegateCommand/516

Imagick should able to convert pdf into image using Ghostscript.