Running from PHP exec('tovid menu .....');

56 views
Skip to first unread message

Bob Howard

unread,
Jul 25, 2013, 8:59:24 PM7/25/13
to tovid...@googlegroups.com
Hi,
For me, the tovid scripts run fine from a terminal as user:'bob:bob'
When called from PHP script, there are enormous permission issues.
$reply = exec('tovid menu ....');    gives
Reply=mkdir: cannot create directory `/.tovid': Permission denied /usr/local/lib/tovid/tovid-init: line 535: /.tovid/preferences: No such file or directory... and more,

The tovid scrips are installed and owned by root:root.
I tried giving Apache 'www-data' the same permissions as me by using 'sudo  usermod --groups root bob www-data and sudo usermod --groups root root www-data
Both worked to change the group of www-data but not enough permissions.

Does anyone have some straws at which to grasp?
Bob


grepper

unread,
Jul 26, 2013, 3:57:42 PM7/26/13
to tovid...@googlegroups.com
Hi Bob
You don't say which tovid version you use. But anyway, off the top of my head I would say this is caused by tovid attempting to create a $HOME/.tovid directory in the root filesystem directory "/" as apache has no HOME. As well the default output directory (and working directory) is $PWD (current directory) so that runs into the same problem - as you are effectively running the script from the root directory. In current tovid you can use environment variables which might get around the problem for the output and working directory, but doesn't address the problem of $TOVID_HOME. For that you may have to edit tovid-init and change the line that says
 
 TOVID_HOME="$HOME/.tovid" to a directory that apache has write access to.
WORKING_DIR=$PWD
OUTPUT_DIR=$PWD
are the 2 lines you would need to modify so it doesn't output to the root directory, or try to create temporary files there. In current tovid the environment variables for these are
TOVID_WORKING_DIR
TOVID_OUTPUT_DIR
(same name with TOVID_ prefix)

Please note that if you haven't upgraded to current SVN and wish to do so that is good, but note that the makemenu/makexml scripts are gone/deprecated and now the todisc script is used for static menus exclusively ('tovid disc').

Good luck, post back either way if you would please.

grepper

Bob Howard

unread,
Aug 4, 2013, 5:37:07 PM8/4/13
to tovid...@googlegroups.com
Thanks, grepper.
Just got back onlne so I'll try it right away.
I think you're on target.
"... tovid attempting to create a $HOME/.tovid directory in the root filesystem directory "/" as apache has no HOME."
Makes perfect sense.  I''l try it.
Bob

grepper

unread,
Aug 9, 2013, 11:16:33 AM8/9/13
to tovid...@googlegroups.com
On 04/08/13 05:37 PM, Bob Howard wrote:
> Thanks, grepper.
> Just got back onlne so I'll try it right away.
> I think you're on target.
> "... tovid attempting to create a $HOME/.tovid directory in the root
> filesystem directory "/" as apache has no HOME."
> Makes perfect sense. I''l try it.
> Bob


Actually, my advice about using environment variables and modifying
tovid-init is probably not going to be enough here, as the python script
'tovid' will also attempt to make an tovid.ini file in ~/.tovid and
~/.tovid is a hardcoded directory in that script. The easiest way around
it I can see that doesn't involve making changes to tovid would be to
give www-data a home. On my debian system it seems to have one:
$ su - www-data
$ echo $HOME
/var/www

So not sure about your system. Additionally you would have to have your
script change directories to /var/www/ or wherever you want that apache
and php have write access to.

best,
Robert

Bob Howard - BCD

unread,
Aug 9, 2013, 12:16:51 PM8/9/13
to tovid...@googlegroups.com
Thanks, grepper,
We're using 0.34 because we just want to make a menu & xml file for this, with our own calls to dvdauthor.  Sometimes we just want a fast 1-video DVD with no menu.

Our Ubuntu 12.04 LTS has Apache's $HOME as www-data, too.
We made good progress and built a DVD w/menu.  The key seems to have been changing ownership of our data drive (/media/HDD2) with
     chown www-data:bob

We may need to rip it all out and start over for our real project.
tovid was first installed from /home/bob so in some circumstances tovid wants to find   /bob/lib/tovid

Our goal is automated DVD creation from PHP web script by feeding mpeg filenames to tovid and/or dvdauthor.

If we do it again, any suggestions as to the proper install directory... or other tips?
Thanks, again,
Bob





--
You received this message because you are subscribed to a topic in the Google Groups "tovid-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tovid-users/TJ4wo-19UNo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tovid-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
BCD Associates: Making Video Interactive Since 1980
www.bcdusa.com
800-223-6734 (800-BCD-MPEG)
405-843-4574

grepper

unread,
Aug 9, 2013, 4:39:30 PM8/9/13
to tovid...@googlegroups.com
On 09/08/13 12:16 PM, Bob Howard - BCD wrote:
> Thanks, grepper,
> We're using 0.34 because we just want to make a menu & xml file for
> this, with our own calls to dvdauthor. Sometimes we just want a fast
> 1-video DVD with no menu.
>
> Our Ubuntu 12.04 LTS has Apache's $HOME as www-data, too.
> We made good progress and built a DVD w/menu. The key seems to have
> been changing ownership of our data drive (/media/HDD2) with
> chown www-data:bob
>
> We may need to rip it all out and start over for our real project.
> tovid was first installed from /home/bob so in some circumstances tovid
> wants to find /bob/lib/tovid
>
> Our goal is automated DVD creation from PHP web script by feeding mpeg
> filenames to tovid and/or dvdauthor.
>
> If we do it again, any suggestions as to the proper install directory...
> or other tips?
> Thanks, again,
> Bob
Hi Bob,
Just as an aside: "tovid disc" has a -no-menu option and -keep-files,
but it doesn't actually create an xml file for that one. I don't think
it is worth adding another option there as a generic "no menu" xml is
easy enough to have on hand.

Getting to the rest of your post. I'm not sure I really understand your
question. The default install directory is /usr/local
(/usr/local/lib/tovid /usr/local/lib/python2.x/dist-packages/libtovid
(or site-packages) /usr/local/bin and so on). That is the suggested
install route for non system packages. A distro would install to /usr
and probably use /usr/share for the shell scripts and perhaps pyshared
for the python modules. If you install to $HOME (/home/bob/lib/ etc) you
would have to set the PYTHONPATH appropriately, or add to sys.path if
using python. You can find the current python path by doing:
python -c "import sys; print(sys.path)" , in a shell.

$ python -c "import sys; print(sys.path)"
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/robert/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']

$ PYTHONPATH=/home/robert/lib/python2.7/dist-packages:$PATH python -c
"import sys; print(sys.path)"
['', '/home/robert/lib/python2.7/dist-packages', '/home/robert/bin',
'/usr/local/bin', '/usr/bin', '/bin', '/usr/local/games', '/usr/games',
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/robert/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']

Dunno if I have come close to answering your question :)

Robert

Reply all
Reply to author
Forward
0 new messages