OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

OO Macro from apache/php

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
precioso77
Newbie
Newbie


Joined: 10 Jun 2005
Posts: 2

PostPosted: Fri Jun 10, 2005 9:42 am    Post subject: OO Macro from apache/php Reply with quote

I went thru the detailed instructions of DannyB (thanks alot)
http://www.oooforum.org/forum/viewtopic.phtml?t=3772

and i succeeded in runnin it from the command line with not probs
this is the script i use:
Code:

#!/bin/sh
#Start fake xserver
nohup /usr/X11R6/bin/Xvfb :25 -screen scrn 800x600x32 &
#Run our script
/usr/local/OpenOffice.org1.1.4/program/soffice -invisible -headless "macro:///mgw.Conversion.ConvertDocToPDF(test.sxw)" -display :25
#Kill the server
/usr/bin/killall Xvfb


it didnt work from apache
then i followed this thread previously posted
http://www.oooforum.org/forum/viewtopic.phtml?p=75055&

so i made apache run the user "apache" gave it a password, /bin/bash shell login, and logged into X with apache and did the OO setup (that runs on the first time) and recreated the macro for that user (because it didnt show me the macro i had put in for root??)

still it doesnt run, the form i submit keeps on loading endlessly, the only thing in the error log is X IO Error

i tried keeping the convert.sh script as root owner, with 777 rights and i tried changing its ownership to apache.. still nothing

plz someone can help

another side question would be are there any threats to giving the user apache a bash shell login ?
cheers
Quote:
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Sat Jun 11, 2005 12:06 am    Post subject: Re: OO Macro from apache/php Reply with quote

Just a guess because I cannot give it a try at the moment.

Your code (section):
precioso77 wrote:
Code:
nohup /usr/X11R6/bin/Xvfb :25 -screen scrn 800x600x32 &
#Run our script
/usr/local/OpenOffice.org1.1.4/program/soffice -invisible -headless "macro:///mgw.Conversion.ConvertDocToPDF(test.sxw)" -display :25


My code (section, unusable this way, but it contains the display code):
Code:
/usr/X/bin/Xvfb :1 -screen 0 800x600x16 &
/usr/bin/soffice -display myserver:1.0

Your display option contains only "-display :25", my contains "-display myserver:1.0". Try your call with "-display yourserver:25.0" or "-display localhost:25.0".

With kind regards
hol.sten
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Sat Jun 11, 2005 8:08 am    Post subject: Reply with quote

When run under apache, what user account is OOo running as? Let's suppose that the user account is 'wwwrun'.

You need to go to this exact pathname...

/home/danny/OpenOffice.org1.1.4

and copy that OpenOffice.org1.1.4 folder over to....

/home/wwwrun/OpenOffice.org1.1.4

Does that help?

Since wwwrun does not have an OpenOffice.org1.1.4 folder in its home directory, OOo tries to go through the "Registration" process. Would you like to register OOo online?
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
precioso77
Newbie
Newbie


Joined: 10 Jun 2005
Posts: 2

PostPosted: Thu Jun 16, 2005 5:51 pm    Post subject: Plz help me analyze this Reply with quote

Danny: apache was running the user "apache" by default. so this is what i did:

- i gave the user apache a bash login from /etc/passwd
- logged into the account, changed the password and logged into X using that password
- ran OO for the first time, did the workstation installation and the registration process that u mentioned. now by default i have a /var/www/.Openoffice1.1.4/ directory
- i checked the /var/www/ for the permissions and it is set correctly
- i redid the steps for creating the macro for user:apache because i couldnt see the one i did for the root user.

still doesnt work. it works from shell command directly but not from apache.

I placed a "strace" before calling out the macro and i was surprised to see several attempts to access files in the root home:
open("/root/.sversionrc", O_RDONLY) = -1 EACCES (Permission denied)
access("/root/.Xauthority", R_OK) = -1 EACCES (Permission denied)
open("/root/.Xdefaults", O_RDONLY) = -1 EACCES (Permission denied)
open("/root/.Xdefaults-virtual", O_RDONLY) = -1 EACCES (Permission denied)
...
and others
uname({sys="Linux", node="virtual", ...}) = 0

why is it still trying to access root files ??

is it possible that it thinksit should be run from user root becuase apache always runs the main process as root
http://lists.debian.org/debian-security/2001/04/msg00055.html

plz help
thanx
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Jun 17, 2005 7:07 am    Post subject: Reply with quote

Apache's main process starts out as root. Then Apache changes which user id it is running as. BUT, Apache probably isn't changing any environment variables. Both the current directory, and the HOME probably point to root's home directory.

Instead of running your script, try running a script that generates output from several commands, such as "set" to dump environment vars, the "id" commeand to see who is running, etc.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group