Re: PHP files executable

David Nebauer <[email protected]>
Newsgroups gmane.text.refdb.devel
Message-ID <[email protected]>
Hi Markus,

Markus Hoenicka wrote:

>I'm not sure as I'm not an Apache expert. I simply followed the
>instructions on the Apache web page how to get PHP scripts executed by
>Apache. The instructions suggest to make the scripts executable.
>
>See e.g. here:
>
>http://httpd.apache.org/docs/1.3/howto/cgi.html
>
>"Remember that the server does not run as you. That is, when the server
>starts up, it is running with the permissions of an unprivileged user
>- usually ``nobody'', or ``www'' - and so it will need extra
>permissions to execute files that are owned by you. Usually, the way
>to give a file sufficient permissions to be executed by ``nobody'' is
>to give everyone execute permission on the file:
>
>        chmod a+x first.pl"
>

I can't claim to be an expert either.  I'm sure the instructions are 
correct as far as they apply to CGI perl scripts.

PHP scripts, on the other hand, appear to be handled differently.  Here 
is a beginner's tutorial on PHP scripting 
<http://php.planetmirror.com/manual/en/tutorial.firstpage.php> which 
says, in part:

"Create a file named hello.php and put it in your web server's root 
directory (DOCUMENT_ROOT) with the following content:
[...]
Use your browser to access the file with your web server's URL, ending 
with the "/hello.php" file reference.
[...]
Note that the file /does not need to be executable/ or special in any 
way. The server finds out that this file needs to be interpreted by PHP 
because you used the ".php" extension, which the server is configured to 
pass on to PHP. Think of this as a normal HTML file which happens to 
have a set of special tags available to you that do a lot of interesting 
things."

Note in the last paragraph the PHP script does not have to be set 
executable.

I experimented with the 'refdbadd.html' file in 
'/usr/share/refdb/www/'.  The "Change database" option executes the 
script 'refdbdquery.php'.  It executed correctly in firefox whether the 
php file was set executable or not.

My conclusion is that PHP scripts do not need to be set executable 
(though clearly CGI perl scripts do).

Regards,
David.


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.