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

293
Vistas
macOS: Using pbcopy from PHP does not work

On macOS there is a terminal utility called 'pbcopy' which copies text into the clipboard. pbcopy < file copies the contents of 'file' into the clipboard. But from PHP (running under Apache, both the standard PHP and Apache included in macOS) it does not work. The only difference is that I have changed the Apache user to my username instead of the standard _www or www-data, for convenience of changing files on my development webserver (which is my Macbook Pro). I am running Apache 2.4.33 and PHP 7.3.11 under Catalina 15.3.

system("pbcopy < /Users/me/.profile");

from PHP does not do anything, but also not issue any errors.

system("pbcopy < /Users/me/.profile 2>&1");

to show stderr errors in PHP.

When running from a terminal

/usr/bin/php -r 'system("pbcopy < /Users/me/.profile");'

it does work: the contents of my .profile is copied into the clipboard. I have given /usr/sbin/httpd accessibility access under Settings => Security & Privacy => Accessibility to allow clipboard access.

Why does this not work under Apache ?

over 4 years ago · Santiago Trujillo
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