Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

461
Views
How do I enable PHP to run XCOPY commands on Windows Server 2019

I have a Word to PDF converter that works from Commandline so we created a middle-ware program to accept commands via Classic ASP. That worked so we then created the middle-ware program as a Windows service and all was working fine until we moved from our dev server (Windows Server 2012) to our production server (Windows Server 2019). Now that Windows service no longer works and spits out errors about not be able to find or connect to COM.

So I dropped the middle-ware Windows service and tried using PHP to run the Word to PDF converter. But that either complains about not finding a COM or just hangs.

The PDF converter dev recommended testing PHP command using XCOPY, and lo and behold the real problem enfolds... PHP does not have the rights/permissions to use XCOPY or the PDF conversion app, or our middle-ware service. An example of the PHP is...

$answer = shell_exec('xcopy /S /I /Q /Y /F "C:\IN\Word.docx" "C:\OUT\"')
echo $answer;

So there must be a difference in security between Windows Server 2012 and 2019. How to fix that and/or give PHP rights to run apps?

Yes, UAC is disabled and the permissions on the IN and OUT folders are read, write, execute for Everyone.

How do I enable PHP run XCOPY commands on Windows Server 2019?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your code works with PHP on Windows Server 2019. If it is not working on your server try the following:

  1. Check that the PDF install went to C:\PDF\ and and not to C:\program Files\ because a space in that folder name can be a killer for PHP which was designed yo run on Apache and not Windows.

  2. In IIS Manager check the Handler Mappings for PHP. You may find one or two:

  • FastCGI
  • PHP_via_FastCGI

They should both point to C:\PHP\php-cgi.exe

If you still get errors, check C:\Windows\Temp\ for any FastCGI errors.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!