Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda