views:

729

answers:

3

How can you run the following script in generating docs by PHPdoc?

#1 sudo -code

sudo source makedoc.sh

I get

no command source

#2 without sudo

The problem is that sudo does not have the command source. I tried to fix the problem unsuccessfully by changing the persmissions of ~/phpdoc/phpdoc to 777 and then running

source makedoc.sh

I get

makedoc.sh:90: permission denied: /home/masi/phpdoc/phpdoc

#3 without sudo

I run

 phpdoc -c makedoc.sh

I get

codes master $ phpdoc -c makedoc.sh
PHP Version 5.2.6-3ubuntu4.2
phpDocumentor version 1.4.2

Parsing configuration file phpDocumentor.ini...
   (found in /usr/share/php/data/PhpDocumentor/)...

done
Maximum memory usage set at 256M after considering php.ini...
using tokenizer Parser
a target directory must be specified
 try phpdoc -h
+1  A: 

sudo source makes very little sense, you are making a new shell as the root user and then trying to change the environment which will then be destroyed with the root shell.

Also, source is only used if you want to be getting changing your environment in the current shell which I'm pretty sure you wouldn't want to be doing with something called "makedoc.sh".

You probably just want to run:

sudo makedoc.sh

Also, never set things to 777, it's never the solution to the problem and it's a security risk.

Mike McQuaid
I get `sudo: makedoc.sh: command not found` after running your last command. --- Assume the folder contains only rubbish which has permissions 777. **How can this be a security risk?**
Masi
Then you need to point directly to the makedoc.sh script, wherever it is. I looked at your source and you don't need to run "source", just sudo.777 is a security risk because it means any user can write to that directory and unless it's own it's own partition (like /tmp should be) they can fill up your drive.
Mike McQuaid
+2  A: 
pavium
It has the shebang #!/bin/bash
Masi
A: 

The one reason for makedocs.sh's existence is to be a convenient shell script for you to use when you always want to reuse the same runtime settings. It is not the way to run phpDocumentor in general.

If you are trying to simply run phpDocumentor against your own code in order to create docs for it, then you need to edit makedocs.sh to set all the runtime arguments to exactly what you want them to be. In particular, the -t argument to specify the target location where the docs should be written.

Really, there should be no need to use sudo to execute phpdoc, unless you are attempting to have the generated documentation written directly into your system-wide PEAR installation's "doc_dir" location. In this case, since root owns PEAR, sudo would be necessary. Maybe your needs do not require your docs to be written to that location?

ashnazg