Question

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
Was it helpful?

Solution

Does the file makedoc.sh have a shebang line (eg !#/usr/bin/bash) so it can be made executable?

chmod +x makedoc.sh

Then

sudo ./makedoc.sh

and see what happens.

The ./ means run makedoc.sh in the current directory (it should fix the file not found error)

Giving permissions of 777 allows anyone to read, write or execute the files. This is the security risk Mike Arthur referred to. It may be more of a potential risk, but it's never good practice to make it easy for others to modify, delete or execute your files.

OTHER TIPS

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.

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top