Nov 22, 2009

Making My Album - problems with rights

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Making My Album - problems with rights

wutske
We have to make something in PHP for school, so I decided to make a complete photoalbum. One of the things that it can is creating and storing thumbnails, but here is where the problems start. The thumbnails have to be stored in a subfolder called 'thumbnails', if this folder doesn't exist, my script creates this folder and everything works like it is supposed to be.
But it doesn't do that the way I want. The folder is made with:
CODE
mkdir($thumbnail_folder, 0777);


but when I check it via FTP, it is set to 755. Even worse is that I can't access or remove this folder because the user and group are set to 99 instead of wutske. If I chmod it afterwards to 0777 with this script. The chmod works fine, but the chown doesn't.
CODE
<?php
if (chmod(thumbnails, 0777))
    echo 'good';
else
    echo 'bad';
    
if (chown(thumbnails, 'wutske'))
    echo 'super';
else
    echo 'terrible';
?>


and this is the error I get
QUOTE
Warning: chown() [function.chown]: Operation not permitted in /home/wutske/public_html/PHP/albums/Ik/chmod.php on line 7


Conclusion, as wutske, I have problems to get to 99 .

But, I have the same problem in the opposite direction, I can't chmod of chown a folder that I made via FTP (user + group = wutske).
QUOTE
Warning: chmod() [function.chmod]: Operation not permitted in /home/wutske/public_html/PHP/albums/chmod.php on line 2



My question is, how can I make PHP chmod folders that I made and how can I let PHP make folders that I can access ? I know it's possible because Gallery can (I just checked it, username=wutske and group=99).


Ps. group=99 , wich group is this ?

 

 

 


Comment/Reply (w/o sign-up)

yordan
Are you talking about your astahost account or talking about your schools's computer ?
If you are talking about your astahost account, do you have a ssh access to your account ? Then you can start verifying things.
If we are talking about your schools account, first of all try to access your folders when connected through ssh or telnet. You will see funny things with chmod. Simply create some Unix scripts creating directories, creating files ("touch myfolder/myfile" will create a file) and chmodding the files.

I guess that the guy who is really creating the folders is the owner of the php binary files, so, his account is probably 99. So, this guy cannot chmod in folders he does not own, unless these folders have been chmodded previously. Moreover, probably the php program cannot change the files and directories permissions in a less severe way than allowed by wutske umask (probably 022).
I think that all the things your gallery users will do, will be made by php, so you probably should think in terms of the php program permissions, and not in terms of wutske user permissions.

Hope that I am right... If so, hope this helped !
Regards
Yordan

 

 

 


Comment/Reply (w/o sign-up)

wutske
I'm talking about my astahost account.

I'd like to be able to upload new albums using an upload script or through FTP (FTP is faster because I can't use ZIP function on astahost). I'm going to change my scripts so they won't try to chmod anymore but just echo that the user should chmod the folder ...

Comment/Reply (w/o sign-up)

develCuy
Hi wutske!

If you get 777 then don't worry be happy!!! biggrin.gif
Remember that the web server runs under a unix user privileges, this means that the folders/files created with PHP will have the same: privileges, user and group as the web server user. In *nix, you can't change the ownership of a folder/file if you are not superuser: root or have enought privileges.

Anyway, your script have to create a folder for thumbnails and you only need 777, forget about chown!!!

BUT!!!!

If sometime, for any reason, you need to create files with your user as owner. Then create a cronjob to run the PHP script, the task will run with CGI and under your user. But this is not useful for your gallery sad.gif

Blessings!

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : making, album, problems, rights

  1. Making A Value In A Textbox Stay
    (11)
  2. Making Something In Mysql Happen Only Once
    (10)
    Hey! I know I am asking alot. But much is happening theese days. Sorry if I disturb with my
    questions. The thing I am trying to do is: Ex. If the user becomes level 2, he should get 5 skill
    points. I can't do this: CODE if($userlevel=5){ mysql_query("UPDATE user SET skillpoints
    =$points+5");} because then it would update everytime the code was loaded. I hope you understand
    what I am trying to do. If not, tell me /smile.gif" style="vertical-align:middle" emoid=":)"
    border="0" alt="smile.gif" /> and i'll try to explain better. Thanks //Feelay....
  3. Making A Link = Mysql_query
    (8)
    Hey! I will try to make this as clear as possible. how can I make the following. I have a list,
    of all members on my site. If I press on a members name(link), I will come to his profile. To come
    to his profile, I need to get out some vaule from the database, but to get out some value from the
    database, I must tell the code, how it should know who the user is (hard to understand?). To do
    that, I must add a mysql_query in the code ( I think), like "SELECT user FROM dbname WHERE
    user=link".. This is just how I think it works. I know it is kinda wrong.. but I don't k....
  4. Five Common Php Database Problems
    (0)
    I just read this excelent article from the IBM's developerWorks website, it's name is Five
    common PHP database problems . This article shows five database problems that occur in PHP
    applications as well as their solutions and include database schema design, database access, and the
    business logic code that uses the database. It is a bit older -a year ago more or less- but i
    think that can be helpful for everybody that works with PHP and MySql. Best regards,....
  5. Making Animated Gifs
    (5)
    Is it possible to make animated images using PHP's GD library? I've done searches, and I
    can't find anything that explains it fully, or doesn't need you to download a special
    program, which obviously, I couldn't use with Astahost. Can anyone help? I'm not aure how
    animated gifs work, I don't know if all the frames are compressed within the .gif file as
    separate images, or whether it's structured another way.....
  6. Bbcode Help
    Making BBCode (9)
    OK well I wanted to add some BBCode to my website but I ran into trouble. At first I was useing str_
    replace() but that does not work if I am trying to make the   
     code. I think I would use preg_match but I am real confused. Could someone post the source code to 
    make: CODE Website   Into: CODE Website Also how would I make the code tag so it
    would replace all withen the two strings with [ and ] example CODE would print the
    html CODE [b] [/b] Do you get what I am trying to do? Thanks, Sparkx Note: I had
    to take out so....
  7. I'm Having Problems With Sessions
    (2)
    I haven't really read much about sessions, i usually study PHP by viewing other's codes and
    learning from it. Here's what keeps on popping out when I open the page. CODE Warning:
    session_start() : Cannot send session cookie - headers already sent by (output started at
    C:\Program Files\xampp\htdocs\maple-radio-live\loggingin.php:7) in C:\Program
    Files\xampp\htdocs\maple-radio-live\loggingin.php on line 40 and CODE Warning: Cannot
    modify header information - headers already sent by (output started at C:\Program
    Files\xampp\htdocs\maple-radio-live....
  8. Htaccess/gd Problems.
    (0)
    On this shell, that has shared apache, php and gd, I have this file working.
    http://users.phoenix-network.org/~tobylane/gd.php But, with the normal htaccess of CODE
    RewriteEngine on RewriteRule ^sig.png$ gd.php http://users.phoenix-network.org/~tobylane/sig.png
    Doesn't work. Also, another gd picture doesn't display the text. CODE
    header("(anti-spam-(anti-spam-(anti-spam-content-type:))) image/png"); $im =
    imagecreatefrompng("button.png"); $bg = imagecolorallocate($im,255,55,25); imagefill($im,0,0,$bg);
    imagestring($im,3,20,5,"Your IP is ",$b....
  9. User Authentication Session Handling Problems
    Authorization server variables not staying across pages (14)
    This is quite a bit of problem I am facing, and I cannot point exactly where I am going wrong. I
    have been lurking around here at the Asta Host forums with regard to login and user authentication
    scripts and I have got as far as this: - Starting a session - Registering a session variable -
    Using the variable to check if the user is authenticated or not. - Authenticating the user through
    MySQL database - Logging of the user, by setting the session variable to un-authenticated I have
    been able to achive the following things too that I think is not related to this proble....
  10. Simple PHP News System Problems
    (1)
    For the new version of my website I'm trying to make a very simple newssytem based on php. Each
    newsitem will get it's own html page, something like this: CODE Welkom HERE
    COMES THE TXT All other data will be stored in a file called news.inc CODE $news
    = array(); $news = '110706_jovolka.html'; $news = '110706_lorum.html'; $news =
    '090706_welkom.html'; $title = array(); $title = 'Over JoVolKa'; $title =
    'Lorum Ipsum'; $title = 'Welkom'; $date = array(); $date = '11/....
  11. Problem With PHP Scripts Without MySQL
    i have problems with scripts (1)
    I've been working on my site, and the first time i tried my hand witha php guestbook script, i
    did good, it worked on my host. but although i successfully installed an "send email" php script,
    but somehow although on the site when i tired out the form, though it says email has been sent,
    i've not received any email at all!!! and i've checked the account that was to specified
    for the email to be sent , i have entered everything right. This are the steps the manual asked me
    to do, QUOTE 1) Open up config.php with a word editor such as notepad. Fill ....
  12. Some Problems Sometimes On Other Sites!
    Others come up with wierd problems! (2)
    I am not the most regular contributer to PHP Builder but every now and then there is just a question
    from a newbie or someone that can not be fixed. I do not know if it is that they do not know how to
    ask the question but this one has been going on too long. It seemed from the question that they
    asked that they wanted to insert some data froma text file into the MySQL database. So after looking
    at their query (the original question) QUOTE Here's part of my code: Code: $result =
    mysql_query("INSERT INTO AL_BVA (contact, time, phone, address, city, state, zip, ....
  13. Php: Write Random Text As Image
    Having problems, help needed! (3)
    I'm trying to create a script that writes text to an image. CODE header("Content-type:
    image/png"); $_phrases = array( "Test 1", "Test 2", "Test 3", "Test 4", "etc." );
    $_rand_phrase = $_phrases ; $_image = imagecreatefrompng("gmail.png"); $_user_width =
    imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value = (200-($user_width + 113)); $_color =
    imagecolorallocate($_image, 165, 164, 164); imagettftext($_image, 9, 0, $_x_value, 16, $_color,
    "tahoma.ttf", $_rand_phrase); imagepng($_image); imagedestroy($_image); I can't see what
    I'm doing w....
  14. Problem: Php And Sendmail - Sendmail Times Out
    Problems with PHP and sendmail (2)
    Hi Guys, On other hosting service I have had major problems using the sendmail function (i.e.
    mail()) from php. Basically the script times out waiting for sednmail to return from the function
    call. Anyone else had this problem and is there a solution? Notice from
    m^e: Make your topic titles as descriptive as possible. Topic title to message body
    relevance is counted as a big factor on this board, and is the key to elicitation of good replies
    from other members. ....
  15. How To Make Chat Room
    help me in making it (1)
    i need the code of making chatroom but plzzz i need it cute chat room /tongue.gif"
    style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> , and it musnt be by java ,
    if you know any website that make chatrooms free plz replay with the website /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Notice
    from m^e: Who the hell approved this post? This is a question - and that too posted in
    the Howtos & Tutorials. How did this get approved ? Moved to right forum. ....

    1. Looking for making, album, problems, rights

See Also,

*SIMILAR VIDEOS*
Searching Video's for making, album, problems, rights
advertisement



Making My Album - problems with rights

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com