Re: [Refdb-devel] PHP files executable
Status: Beta
Brought to you by:
mhoenicka
From: David N. <dav...@sw...> - 2005-09-26 09:10:19
|
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. |