SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to Change Permissions with PHP Script?

    I am trying to use Smarty and I am getting the error below. I'm on a shared server and cannot change the include_path in the php.ini file so I'm going to try and change the ownership of the Smarty files to nobody. Unfortunately, I cannot do this via the command line.

    Can soembody tell me how I can do this via a PHP script? I'd like to know how to change ownership to a file and a folder.

    Fatal error: Failed opening required '//Smarty-2.3.0/Smarty_Compiler.class.php' (include_path='') in //Smarty-2.3.0/Smarty.class.php on line 1084
    John Saunders

  2. #2
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JohnSaunders
    I am trying to use Smarty and I am getting the error below. I'm on a shared server and cannot change the include_path in the php.ini file so I'm going to try and change the ownership of the Smarty files to nobody. Unfortunately, I cannot do this via the command line.

    Can soembody tell me how I can do this via a PHP script? I'd like to know how to change ownership to a file and a folder.

    Fatal error: Failed opening required '//Smarty-2.3.0/Smarty_Compiler.class.php' (include_path='') in //Smarty-2.3.0/Smarty.class.php on line 1084
    http://www.php.net/manual/en/function.chmod.php

    Hope this helps

  3. #3
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to change ownership of a file to nobody, so would i just have to run this in the same directory as the file?

    PHP Code:
    <?php chown ("Smarty-3.2.0, nobody"); ?>
    (this is a directory)
    John Saunders

  4. #4
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JohnSaunders
    I need to change ownership of a file to nobody, so would i just have to run this in the same directory as the file?
    PHP Code:
    <?php chown ("Smarty-3.2.0, nobody" ); ?>
    (this is a directory)
    Did you read the documentation?

    Attempts to change the owner of the file filename to user user (specified by name or number). Only the superuser may change the owner of a file.
    Im not to familiar with file permissions, but if im not mistaken, you have to chmod to 777. However, if i was you i would go back to the documentation of chmod and read all the user contributions. Im pretty sure you'll find the answer to your question.

  5. #5
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're barking up the wrong tree. Just add
    Code:
    php_value include_path "your/include/path:another/include/path:etc"
    to your .htaccess
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  6. #6
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    datune,

    Thanks, I'll read through the docs.

    anode,

    Do you know what exactly I should put for the path? The people who made the script said I'm getting this error because:

    That means PHP module can not include a file with Smarty class and you should correct include_path setting in php.ini Try to set it to:

    include_path = ".:.."


    I can't change this to my php.ini file because I don't have root access.


    My phpinfo script shows the include_path is set to: .:/usr/local/lib/php.

    I tried adding this line in an .htaccess file in the Smarty-2.3.0 folder, but it still comes up with this same error. Any ideas what I should use?

    php_value include_path "with the lines below"


    home/login/public_html/cart
    home/login/public_html/cart/Smarty-2.3.0
    /usr/local/lib/php
    .:../usr/local/lib/php"
    John Saunders

  7. #7
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To clarify, you should use the .htaccess in your document root(public_html, in this case)
    Code:
    php_value include_path ".:.."
    should do it as per their instructions.
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  8. #8
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anode,

    I put the lines below in my root web's htaccess file and deleted all others, but the same error is still coming up:

    Code:
    <IfModule mod_php4.c>
     php_flag magic_quotes_gpc "on"
     php_value include_path ".:.."
    </IfModule>
    John Saunders

  9. #9
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After re-reading your original post and the Smarty install instructions:
    Try putting
    PHP Code:
    define('SMARTY_DIR','/path/to/smarty/install/'); 
    at the top of your script.
    Last edited by anode; Apr 4, 2003 at 17:18.
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  10. #10
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anode,

    THANK YOU!!!!!!!!!!!!!!!!!!!!

    It finally works! I've spent hours trying to get this damn cart to work and it is now working!!!!!
    John Saunders


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •