Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

464
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda