473,394 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why to use PHP

I have been using PHP for several years now, but I have been given a
project at my High School which has recently set up a web server, which
I would love to use PHP with (and Smarty, but that's a different
matter).

The only problem is that I need to convince the Head Teacher of
Computing that it's a good idea to install PHP. His main concern is
that a student will be able to download a script off the Internet and
use it to look at other user's documents, steal passwords, etc..

Any ideas as to what I can tell him?

Oct 25 '06 #1
17 1457
TheTeapot wrote:
I have been using PHP for several years now, but I have been given a
project at my High School which has recently set up a web server, which
I would love to use PHP with (and Smarty, but that's a different
matter).

The only problem is that I need to convince the Head Teacher of
Computing that it's a good idea to install PHP. His main concern is
that a student will be able to download a script off the Internet and
use it to look at other user's documents, steal passwords, etc..

Any ideas as to what I can tell him?
Tell him to learn what file permissions and users are.
A PHP script runs as a certain user (often apache or www-data or nobody),
and thus PHP has the rights of that user.
So running PHP is no different from having more users on the same system.
If you store a file in your private home directory, and you decide to give
the world read/write permissions on that file, anybody can read/change it.

This is a matter of good usermanagement, and educated users. PHP has nothing
to do with that.

Tel him that.

Also, what OS are we talking about? Some *nix or W$? If the latter, don't
mind talking about security, the number of patches (to patch rootaccess)
for W$ released indicated that W$ will never be anywhere near secure in the
near future.

If he doesn't listen, ask him for detailed arguments, and post them here. I
am sure somebody will help you to make your case for the sake of PHP.
:-)

Regards,
Erwin Moller
Oct 25 '06 #2
Sorry, I meant to include a few extra things in that last email that I
thought of after sending. (as I generally always do)

#1: It's a Mac OS X system.
#2: I'll be installing the PHP build "Entropy" by Marc Liyanage.
#3: I generally get on quite well with him, I just need to convince him
that PHP when running as (www) user can't do anything dangerous.

Is there some obvious document which says all of this (which us
developers know automatically)?

Those who can't do something, teach it!

Erwin Moller wrote:
TheTeapot wrote:
I have been using PHP for several years now, but I have been given a
project at my High School which has recently set up a web server, which
I would love to use PHP with (and Smarty, but that's a different
matter).

The only problem is that I need to convince the Head Teacher of
Computing that it's a good idea to install PHP. His main concern is
that a student will be able to download a script off the Internet and
use it to look at other user's documents, steal passwords, etc..

Any ideas as to what I can tell him?

Tell him to learn what file permissions and users are.
A PHP script runs as a certain user (often apache or www-data or nobody),
and thus PHP has the rights of that user.
So running PHP is no different from having more users on the same system.
If you store a file in your private home directory, and you decide to give
the world read/write permissions on that file, anybody can read/change it.

This is a matter of good usermanagement, and educated users. PHP has nothing
to do with that.

Tel him that.

Also, what OS are we talking about? Some *nix or W$? If the latter, don't
mind talking about security, the number of patches (to patch rootaccess)
for W$ released indicated that W$ will never be anywhere near secure in the
near future.

If he doesn't listen, ask him for detailed arguments, and post them here. I
am sure somebody will help you to make your case for the sake of PHP.
:-)

Regards,
Erwin Moller
Oct 25 '06 #3
TheTeapot wrote:
I have been using PHP for several years now, but I have been given a
project at my High School which has recently set up a web server, which
I would love to use PHP with (and Smarty, but that's a different
matter).

The only problem is that I need to convince the Head Teacher of
Computing that it's a good idea to install PHP. His main concern is
that a student will be able to download a script off the Internet and
use it to look at other user's documents, steal passwords, etc..

Any ideas as to what I can tell him?
If the other students can upload to the server, sure they can, unless
your teacher knows how to set permissions properly (which it sounds like
he doesn't). But in that case there probably are other programming
languages on the system the person could use.

And if others don't have upload capability, there's no problem as long
as you design the site properly.

The bottom line is - without a programming language you'll be stuck with
static pages. And if you want/need dynamic pages, you need *some*
programming language. And in many cases PHP is a good solution.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 25 '06 #4
R K
If uploading enabled, file permissions can't stop a user from
uploading a file, say "hole.php", then executing that file with the
URL http://host/uploaddir/hole.php. All PHP files just have rw or just
r permissions and they are still executed by the server. Seems like a
PHP issue. Are we leaving this up to developers to take care not to
create this hole?

BTW, how do I fix this in an administrative way?

Thx
-R

Oct 25 '06 #5
R K
BTW, how do I fix this in an administrative way?
Nevermind. Put this in the .htaccess file in the upload directory:

php_value engine off

HTH,
-R

Oct 25 '06 #6
TheTeapot wrote:
I have been using PHP for several years now, but I have been given a
project at my High School which has recently set up a web server, which
I would love to use PHP with (and Smarty, but that's a different
matter).

The only problem is that I need to convince the Head Teacher of
Computing that it's a good idea to install PHP. His main concern is
that a student will be able to download a script off the Internet and
use it to look at other user's documents, steal passwords, etc..

Any ideas as to what I can tell him?
If you have no ideas why you'd want to use PHP then maybe it's not a
good idea.

Oct 25 '06 #7
Rik
R K wrote:
>BTW, how do I fix this in an administrative way?

Nevermind. Put this in the .htaccess file in the upload directory:

php_value engine off
Upload/tmp directories shouldn't even be accessable by http....

/dir/
/uploadtmp/
/wwwroot/
--
Rik Wasmus
Oct 25 '06 #8
R K

Rik wrote:
R K wrote:
BTW, how do I fix this in an administrative way?
Nevermind. Put this in the .htaccess file in the upload directory:

php_value engine off

Upload/tmp directories shouldn't even be accessable by http....

/dir/
/uploadtmp/
/wwwroot/
Yeah, but suppose you wanted an upload to be web accessible after it's
moved from the tempdir?

That final directory needs the .htaccess, doesn't it?
-R

Oct 25 '06 #9
Rik
R K wrote:
Rik wrote:
>R K wrote:
>>>BTW, how do I fix this in an administrative way?

Nevermind. Put this in the .htaccess file in the upload directory:

php_value engine off

Upload/tmp directories shouldn't even be accessable by http....

/dir/
/uploadtmp/
/wwwroot/

Yeah, but suppose you wanted an upload to be web accessible after
it's moved from the tempdir?

That final directory needs the .htaccess, doesn't it?
Well, I'm very curious.
You want PHP to be available, but disabled?
When do you want PHP to run?
And it's far better to put these kinds of settings in httpd.conf then
..htaccess, and forbidding to use .htaccess to change these values. If they
have access to the directory, what stops them from deleting or altering the
..htaccess file, thus enabling PHP? I assume that when a user uploads a
file, he is allowed the either edit or delete it..
--
Rik Wasmus
Oct 25 '06 #10
R K

Rik wrote:
R K wrote:
Rik wrote:
R K wrote:
BTW, how do I fix this in an administrative way?

Nevermind. Put this in the .htaccess file in the upload directory:

php_value engine off

Upload/tmp directories shouldn't even be accessable by http....

/dir/
/uploadtmp/
/wwwroot/
Yeah, but suppose you wanted an upload to be web accessible after
it's moved from the tempdir?

That final directory needs the .htaccess, doesn't it?

And it's far better to put these kinds of settings in httpd.conf then
.htaccess, and forbidding to use .htaccess to change these values. If they
Then I'd have to reboot the server for every change, not interested in
that. Already short on time and this is not my real job.
have access to the directory, what stops them from deleting or altering the
.htaccess file, thus enabling PHP? I assume that when a user uploads a
file, he is allowed the either edit or delete it..
Wouldn't permissions on .htaccess prevent overwrite if the server is
not running as root? guess there's one way to find out...

-R

Oct 25 '06 #11
Rik
R K wrote:
Then I'd have to reboot the server for every change, not interested
in that. Already short on time and this is not my real job.
Well, there's security and there's the illusion of security. Good luck.
--
Rik Wasmus
Oct 25 '06 #12
R K

Rik wrote:
R K wrote:
Then I'd have to reboot the server for every change, not interested
in that. Already short on time and this is not my real job.

Well, there's security and there's the illusion of security. Good luck.
It's worked for me so far. Gold plating every damn thing hasn't. Back
at ya.

-R

Oct 25 '06 #13
Rik
R K wrote:
Rik wrote:
>R K wrote:
>>Then I'd have to reboot the server for every change, not interested
in that. Already short on time and this is not my real job.

Well, there's security and there's the illusion of security. Good
luck.

It's worked for me so far. Gold plating every damn thing hasn't.
Back at ya.
Hmmmf.
Last piece of advice:
if you have different users, different user-dirs, but want to apply
unoveridable settings to every dir:
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html
http://httpd.apache.org/docs/2.0/howto/public_html.html

And check AllowOverride

For more information alt.apache.configuration
--
Rik Wasmus
Oct 26 '06 #14
Rather than an upload directory, it has been set up to use the user's
"Sites/" folder.

I think that the end solution will be to point out that few students
will know how to code and use the PHP on the system, and none of the
students I know can actually use PHP to hack a server.

The other thing is that it isn't part of the Internet, only the
school's Intranet.

Thanks everyone, I'll see how I go tomorrow.

Rik wrote:
R K wrote:
Rik wrote:
R K wrote:
Then I'd have to reboot the server for every change, not interested
in that. Already short on time and this is not my real job.

Well, there's security and there's the illusion of security. Good
luck.
It's worked for me so far. Gold plating every damn thing hasn't.
Back at ya.

Hmmmf.
Last piece of advice:
if you have different users, different user-dirs, but want to apply
unoveridable settings to every dir:
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html
http://httpd.apache.org/docs/2.0/howto/public_html.html

And check AllowOverride

For more information alt.apache.configuration
--
Rik Wasmus
Oct 26 '06 #15
TheTeapot wrote:
none of the
students I know can actually use PHP to hack a server.
I wouldn't assume that if I were you. You're just asking for trouble.
>
The other thing is that it isn't part of the Internet, only the
school's Intranet.
It would be better the other way around. On the internet, they
wouldn't be able to cause much damage, but if they find a hole
somewhere in your local intranet, then, well... let's just say that I
hope nothing private or critical is stored where they can get to it
such as social security numbers, grades, or medical information.

Oct 26 '06 #16
>Upload/tmp directories shouldn't even be accessable by http....
>>
/dir/
/uploadtmp/
/wwwroot/

Yeah, but suppose you wanted an upload to be web accessible after it's
moved from the tempdir?

That final directory needs the .htaccess, doesn't it?
Not necessarily. You can make a file "web accessible" without putting it
in a publicly accessible directory. You can create a php file (publicly
accessible) that sends the appropriate Content-Type header and sends the
contents from a file (that is not publicly accessible) to the client.
Also, the file does not necessarily exist on the server as it is sent to
the client (you can open an image, rescale it, add a copyright message
and send the result of that to the client, for example).

You can control the "downloader" php file with GET-parameters or with
session data, so have much control over the accessibility.

Best regards
Oct 26 '06 #17
TheTeapot wrote:
Rik wrote:
>>R K wrote:
>>>Rik wrote:

R K wrote:

>Then I'd have to reboot the server for every change, not interested
>in that. Already short on time and this is not my real job.

Well, there's security and there's the illusion of security. Good
luck.

It's worked for me so far. Gold plating every damn thing hasn't.
Back at ya.

Hmmmf.
Last piece of advice:
if you have different users, different user-dirs, but want to apply
unoveridable settings to every dir:
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html
http://httpd.apache.org/docs/2.0/howto/public_html.html

And check AllowOverride

For more information alt.apache.configuration
--
Rik Wasmus


Rather than an upload directory, it has been set up to use the user's
"Sites/" folder.

I think that the end solution will be to point out that few students
will know how to code and use the PHP on the system, and none of the
students I know can actually use PHP to hack a server.

The other thing is that it isn't part of the Internet, only the
school's Intranet.

Thanks everyone, I'll see how I go tomorrow.
(Top posting fixed)

I agree with Moot. Students are much smarter and capable than you
think. Some of them may have been doing PHP for several years - and
would know a lot more than you do.

If you don't know how to properly secure your system you are not only
looking for trouble - you're opening the door wide and putting a huge
"Welcome" mat on the porch.

And what's it going to cost your school in attorney's fees, reputation,
etc. if someone hacks the grades database? Or gets a list of SSN's, etc.?

If you can't secure it properly, don't have *any* access to anything
private available. Better yet, don't allow students on the system in
the first place. Set up a different server for them which is isolated
from the rest of the school's network.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 27 '06 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.