php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50663 exec and shell_exec don't works with msginit
Submitted: 2010-01-04 22:23 UTC Modified: 2010-01-05 09:43 UTC
From: samuel dot roze at gmail dot com Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 5.3.1 OS: Debian 5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: samuel dot roze at gmail dot com
New email:
PHP Version: OS:

 

 [2010-01-04 22:23 UTC] samuel dot roze at gmail dot com
Description:
------------
The function exec or the shell_exec function are not working with the msginit (gettext) program.

Reproduce code:
---------------
Create an empty "/home/user/file.pot" file.

<?php
$exec = exec('msginit -i "/home/user/file.pot" -o "file.po"');
var_dump($exec);
?>

Expected result:
----------------
string(X) "/home/d-sites/myonlinessh/includes/locales/ps_AK/messages a ?t? cr??."

and that the file.po file was created.

Actual result:
--------------
string(0) ""
and the file.po doesn't exists.

Note: there's any error and the same command, with the www-data user (used by Apache) works in my shell!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 22:39 UTC] samuel dot roze at gmail dot com
Notice: This PHP test work when using the "php file.php" command but no on Apache. With the command, the message "/home/samuel/D?veloppement/workspaces/PHP/GetTextEdit/tests/php/file.po a ?t? cr??." is printed on the shell, nothing is sent to PHP.
 [2010-01-04 23:18 UTC] rasmus@php.net
Sorry, but these types of issues are never PHP-related.  You just 
proved it yourself that when you ran PHP in a cli environment, it 
worked fine.  But in the Apache environment it didn't.  Therefore it 
has to do with something in your Apache environment.  Like environment 
variables, LOCALE, or maybe even a requirement for a controlling tty, 
or something along those lines.  Regardless, it has nothing to do with 
PHP.  strace the working one and compare it to the strace of the non-
working one and figure out what is going on.
 [2010-01-05 06:11 UTC] samuel dot roze at gmail dot com
Well, I said that it works on cli... Actually, the "file.po" file is created, BUT the result of $exec is still empty instead of be the expected string! The this string is directly printed on my command line, and isn't returned to PHP.
 [2010-01-05 06:49 UTC] rasmus@php.net
Yes, but from the command line stderr is printed alongside stdout.  
exec will only give you whatever is sent to stdout.  Try redirecting 
stderr.  But again, this is not a PHP bug.  And this is not a support 
forum.
 [2010-01-05 09:43 UTC] samuel dot roze at gmail dot com
Okay. In fact it apears that it isn't a PHP bug. I'm sorry.

Regards,
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC