Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16
  1. #1
    Member
    Join Date
    Sep 2005
    Posts
    7

    Angry PHP permissions

    I am using an account that I created using whm. PHP doesn't have permissions to write files. How can I fix that without using PHP in CGI mode or CHMODing the files to 777? I tried using CGI mode and that worked, but eAccelerator doesn't support PHP using CGI mode. By the way, how can I make my site support Apache2? PHP also can't upload files.

  2. #2
    Member
    Join Date
    Apr 2003
    Posts
    174
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    If PHP scripts are running as the apache user then that user needs write access to the file in order to write to it - you can either make it world-writable (which you already said you don't want to do), chgrp the files and chmod them to allow the group write access or chown them so they are owned by apache.

  3. #3
    Member
    Join Date
    Sep 2005
    Posts
    7

    Default

    I have tried chown but it doesn't work. PHP is running as nobody so it doesn't work.

  4. #4
    Registered User kite's Avatar
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    3

    Default

    Copy/Paste this to a new file:

    <?php

    echo phpinfo();

    ?>

    cPanel houses PHP for vhosts (on my machine) in /home/virthttpds/usr or something along those lines. If you are trying to upgrade to Apache2 or PHP5 you will have to update *this* php.ini to look for your apxs (I assume, /usr/local/apache2/bin/apxs).

    I am not sure if this helps or not. Good Luck regardless! =]


    Quote Originally Posted by james2
    I have tried chown but it doesn't work. PHP is running as nobody so it doesn't work.

  5. #5
    Member amal's Avatar
    Join Date
    Nov 2003
    Location
    India
    Posts
    153

    Thumbs up

    Quote Originally Posted by james2
    I am using an account that I created using whm. PHP doesn't have permissions to write files. How can I fix that without using PHP in CGI mode or CHMODing the files to 777?
    Only other options are

    1. chgrp the directory to nobody ( I'm assuming that your apache is running as the user - nobody ), and then give it right permissions. ( You have to be root to do this )

    ie,

    chgrp nobody $dir ( and or $file )
    chmod g+w $dir ( and or $file )

    where $file is the absolute path of the file and
    $dir is the absolute path of the directory on which the file resides

    2. Enable phpsuexec or download and install suphp.. phpsuexec is the recommended option..

    Quote Originally Posted by james2
    PHP also can't upload files.
    The user nobody needs write access to the directory where it's going to upload... Only then will it upload.

    ######
    Regards,
    Amal

  6. #6
    Member
    Join Date
    Sep 2005
    Posts
    7

    Default

    phpsuexec and suphp are cgi modes. i don't want php running in cgi mode.

  7. #7
    Member
    Join Date
    Sep 2005
    Posts
    7

    Default

    chgrp also doesn't work

  8. #8
    Member
    Join Date
    Sep 2005
    Posts
    7

    Angry

    THIS IS AN EMERGENCY. I NEED TO FIX THE PERMISSIONS.

  9. #9
    Member amal's Avatar
    Join Date
    Nov 2003
    Location
    India
    Posts
    153

    Default

    Quote Originally Posted by james2
    chgrp also doesn't work
    check the apache error log, when you try to open the page...
    and paste the logs here...

    also paste the result of

    ls -l directory
    ls -l directory/file

  10. #10
    Member
    Join Date
    Sep 2005
    Posts
    7

    Angry

    i used to do it that way but uploading new php files won't work. uploading files can't be deleted if you are not the root user. i must chmod the files again when i re-upload them. i must chmod the files when i upload them. uploaded files using php can't be deleted except the root user. i cannot update my site easily because of it. i spend too much time manually updating my site because php can't upload files. i am wasting time. i am always frustrated and angry becuase i can't upload the files. i am very mad. i hate rechmoding the files every time i upload them. i want apache to run php as the root user. i want my account have privileges as the root user since i created it. i am very mad for many days because i can't upload the files. i hate manually wasting time manually uploading files. php can't write files. i have to manually upload the files every time wasting too much time. my site hasn't been updated for a very long time because of it. my site is not updating as much as i want my site to update. i wasted hundreds of hours manually uploading files. i am very mad. i am always mad because of it. i don't know how to upload the files. i can't do anything else except spending hours every day fixing this problem. you don't know how much time i waste. i don't know how to fix it. i want to fix it immediately. could you show me how to fix this.

  11. #11
    Member phpman's Avatar
    Join Date
    Sep 2003
    Location
    Rio de Janeiro - Brazil
    Posts
    50

    Default

    James

    Send me your phpinfo.
    Flávio Pedro
    Intellinoc Specialists
    ---
    Software installation, 24/7 server management,and security.
    hardening Red Hat Certified Engineer | Certified Information Security Systems Professional

    ---
    Intelligent Solutions - Intelligent People
    dedicated servers, collocation, shared and reseller hosting, managed solutions and background services.

  12. #12
    Member amal's Avatar
    Join Date
    Nov 2003
    Location
    India
    Posts
    153

    Angry

    Quote Originally Posted by james2
    i used to do it that way but uploading new php files won't work. uploading files can't be deleted if you are not the root user. i must chmod the files again when i re-upload them. i must chmod the files when i upload them. uploaded files using php can't be deleted except the root user. i cannot update my site easily because of it. i spend too much time manually updating my site because php can't upload files. i am wasting time. i am always frustrated and angry becuase i can't upload the files. i am very mad. i hate rechmoding the files every time i upload them. i want apache to run php as the root user. i want my account have privileges as the root user since i created it. i am very mad for many days because i can't upload the files. i hate manually wasting time manually uploading files. php can't write files. i have to manually upload the files every time wasting too much time. my site hasn't been updated for a very long time because of it. my site is not updating as much as i want my site to update. i wasted hundreds of hours manually uploading files. i am very mad. i am always mad because of it. i don't know how to upload the files. i can't do anything else except spending hours every day fixing this problem. you don't know how much time i waste. i don't know how to fix it. i want to fix it immediately. could you show me how to fix this.
    Why do u want to show ur anger with php on the cpanel forum.. You do not want to run php with phpsuexec, but you want to make php give u output similar to that. Then there is no point in having phpsuexec. phpsuexec's use is to solve this problem..

    And did you say you need php to run as root? Well, that'll be like sending a formal invitation for hackers to hack your server. They will get root access, if there is an exploit in a php program.

    And do remember that files uploaded using php will always have the ownership of nobody. The user CANNOT delete files under the ownership of nobody. Only options u have are

    1. Delete it with another php script.
    2. Write a cron on the server to change the permissions of the uploaded files , say every hour.

  13. #13
    Member
    Join Date
    Apr 2003
    Posts
    174
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by james2
    THIS IS AN EMERGENCY. I NEED TO FIX THE PERMISSIONS.
    You should realise that no one here is under any formal obligation to help you. You might try being a little more polite...

  14. #14
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    Indeed. If you're in need of urgent support then you'll have to hire a server admin or seek help from your datacenter. These forums are not here to provide you with support, they're simply for server admins to exchange help and ideas about cPanel.

    Not relevant in this thread or any of the posters herein, but the keyword in that sentence that is overlooked by a notable few is exchange.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  15. #15
    cPanel Partner NOC cPanel Partner NOC Badge jester.ro's Avatar
    Join Date
    Feb 2004
    Location
    Bucharest, Romania
    Posts
    304

    Default

    Quote Originally Posted by james2
    i used to do it that way but uploading new php files won't work. uploading files can't be deleted if you are not the root user. i must chmod the files again when i re-upload them. i must chmod the files when i upload them. uploaded files using php can't be deleted except the root user. i cannot update my site easily because of it. i spend too much time manually updating my site because php can't upload files. i am wasting time. i am always frustrated and angry becuase i can't upload the files. i am very mad. i hate rechmoding the files every time i upload them. i want apache to run php as the root user. i want my account have privileges as the root user since i created it. i am very mad for many days because i can't upload the files. i hate manually wasting time manually uploading files. php can't write files. i have to manually upload the files every time wasting too much time. my site hasn't been updated for a very long time because of it. my site is not updating as much as i want my site to update. i wasted hundreds of hours manually uploading files. i am very mad. i am always mad because of it. i don't know how to upload the files. i can't do anything else except spending hours every day fixing this problem. you don't know how much time i waste. i don't know how to fix it. i want to fix it immediately. could you show me how to fix this.


    This sounds like a speech from MojoJojo .

    Anyway, you could modify your php scripts to do a chmod on the files AFTER uploading them.

    http://www.php.net/manual/en/function.chmod.php

Similar Threads & Tags
Similar threads

  1. is it possible to change default permissions for php generated files?
    By ArbuZz in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-10-2009, 08:49 AM
  2. Problems with permissions and php suexec
    By BigBirdy in forum New User Questions
    Replies: 3
    Last Post: 08-16-2007, 09:53 AM
  3. php permissions
    By PDW in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-11-2006, 10:43 PM
  4. making sure php has correct permissions
    By EMS in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-30-2003, 01:50 PM
  5. php mysql permissions
    By carperman in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-04-2002, 02:56 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube