Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5979457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:39:42+00:00 2026-05-22T21:39:42+00:00

I am logged in to linux feora 15 distro with username: stackoverflow. My browser

  • 0

I am logged in to linux feora 15 distro with username: stackoverflow.
My browser execute in the local system a PHP script to play a music using PHP system(“mplayer /tmp/stackoverflow.wav”), passthru(“mplayer /tmp/stackoverflow.wav”) command. Such as linux command.

As a user stackoverflow i dont hear any audio. But i can see that mplayer /tmp/stackoverflow.wav is running which has duration of 8minutes audio.

My question is: how can i use PHP system(“mplayer /tmp/stackoverflow.wav”); to switch user and run the same command, so that i can hear my music with my PHP?

<?php
// for example
switchuser("su stackoverflow password");
system("mplayer /tmp/itworks.wav");
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:39:42+00:00Added an answer on May 22, 2026 at 9:39 pm

    The direct answer to your question would be to use sudo, as in

    system("sudo -u <username> mplayer /tmp/itworks.wav")
    

    But, I’m not sure this will solve your problem. Firstly, where do you want the sound outputted? The server or the client/browser? The above technique will work on the server. For the browser, you’d need to get the client to load the .wav file as an object or some such and deal with it, presumably via a plugin.

    You mention that you can see a running mplayer process though? If you are at the server (or the server and client are on the same physical machine) and you can’t hear any output, then there’s something else going on. It’s possible that the web server process user doesn’t have permission to use the audio card, but then I doubt the mplayer process would continue for so long without terminating with “permission denied” error. To figure this out, we’d need more info I guess

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Eclipse in Linux through a remote connection (xrdp). My internet got
I'm using Python 2.5 on Linux, in multiple parallel FCGI processes. I use chars
I have a Java program that I'd like to daemonize on a linux system.
Is there any way/command to detect ongoing telnet sessions? I have a linux system
The corrupt table entry is logged in the error file something like this... /usr/local/mysql/bin/mysqld:
I would like to allow the logged user to edit MediaWiki/Common.css without adding them
I want to do what myopenid does -- once you've logged, you can click
When you get a badge or aren't logged in to stack overflow there's a
Is there any API to get the currently logged in user's name and password
Is there a way to determine who is logged on to a particular (remote)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.