php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71796 exec cant work when the cmd is too long
Submitted: 2016-03-11 11:35 UTC Modified: 2016-03-17 06:36 UTC
From: hehu2012 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.0.4 OS: Centos6.7 x86
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hehu2012 at gmail dot com
New email:
PHP Version: OS:

 

 [2016-03-11 11:35 UTC] hehu2012 at gmail dot com
Description:
------------
 I use

    exec("`fmpeg -i /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.mp4 -y -f mjpeg -ss 3 -t 0.001 -s 640x1136 /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.jpg")

in php file, it doesn't work. But I use `exec("whoami")`, it work well. When I use

    fmpeg -i /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.mp4 -y -f mjpeg -ss 3 -t 0.001 -s 640x1136 /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.jpg

in command line it work well. But when I use

    exec("`fmpeg -i /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.mp4 -y -f mjpeg -ss 3 -t 0.001 -s 640x1136 /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.jpg")

in php it doesn't work.

Test script:
---------------
exec("fmpeg -i /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.mp4 -y -f mjpeg -ss 3 -t 0.001 -s 640x1136 /var/www/ad-1/www/uploads/ad/v/5e/8f/98/88/5e8f98881c4da88fb31a1fe1b93c45d6.jpg")

Expected result:
----------------
exec can work well when the cmd is long?

Actual result:
--------------
It return code 127

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-11 12:11 UTC] g dot sokol99 at g-sokol dot info
Do you use "ffmpeg" instead of "`fmpeg"?
 [2016-03-11 18:37 UTC] stas@php.net
-Status: Open +Status: Feedback -Package: PHP Language Specification +Package: *General Issues
 [2016-03-17 06:06 UTC] hehu2012 at gmail dot com
-Status: Feedback +Status: Open
 [2016-03-17 06:06 UTC] hehu2012 at gmail dot com
Thank you!I have resolved this question. It isnot a bug.I didnt add ffmpeg env
 [2016-03-17 06:19 UTC] g dot sokol99 at g-sokol dot info
Should it be closed?
 [2016-03-17 06:36 UTC] yohgaki@php.net
-Status: Open +Status: Not a bug
 [2016-03-17 06:36 UTC] yohgaki@php.net
This was not a bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 11:02:27 2025 UTC