vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   chmod() question (https://vborg.vbsupport.ru/showthread.php?t=75382)

Revan 01-29-2005 06:23 PM

chmod() question
 
What would have to be done to allow chmod() to work prop?
My host took off open_basedir restrictions for my user, but it still would not work...
Im writing a script to run on this host and this host alone, so it would be good if the files could be made writable and back again on demand.
Host is running php4/a linux distro/apache1.3

TIA :)


//peace

Zachery 01-29-2005 07:36 PM

Quote:

Originally Posted by Revan
What would have to be done to allow chmod() to work prop?
My host took off open_basedir restrictions for my user, but it still would not work...
Im writing a script to run on this host and this host alone, so it would be good if the files could be made writable and back again on demand.
Host is running php4/a linux distro/apache1.3

TIA :)


//peace

where are you trying chmod to, and what are you putting in the function?

Revan 01-29-2005 08:13 PM

PHP Code:

<?php
if (!is_writable('test.txt'))
{
    if (!
chmod('test.txt'0777))
    {
        echo 
"owned";
    }
    else
    {
        echo 
"yay";
    }
}
?>

Getting "operation not permitted" error.
And yes, the text file does exist and it is currently chmod()'ed to 644 (default).

miz 01-29-2005 11:36 PM

did you tried also with full patch of file ?

like

PHP Code:

$mydir getcwd();
chmod($mydir."/test.txt"0777


Revan 01-29-2005 11:41 PM

Yup, now that is tried too.
Warning: chmod(): Operation not permitted in /public_html/test.php on line 5
Bastard php :p

miz 01-29-2005 11:46 PM

heh,
well maybe the host dosent allow chmod change at all

can you change chmod via ftp or ssh cilent ?

Revan 01-30-2005 09:12 AM

Yes I can, that's not the problem. I want the script to be able to change chmod on command, since it will be writing to a config file which only needs to be writable while writing.
Host tried to enable chmod in php, but didn't know how to do it.
I also looked through php.ini and theres nothing about "chmod" in there...

Jolten 01-30-2005 12:33 PM

Sometimes the public_html folder is an alias of a www folder (ASO does this). IF this is the case.. change your path to /www/test.php to use the actual file directory and not an alias directory.

miz 01-30-2005 12:37 PM

can you give more info about your host ?
like php version and Os

also please check if php is under safe_mode
cuse some function dosent work with safe mode
to check use this script

PHP Code:

<?php 
// Check for safe mode
if( ini_get('safe_mode') ){
   echo 
"Safe mode is on";
}else{
  echo 
"Safe mode is off";
}

?>

if safe mode is on turn it off and try again
and please report.

edit :

YEP i was right chmod is disabled on safe mode

you can find all of functions that dosent work with safe mode
here

lets hope this is the problem.

Revan 01-30-2005 06:11 PM

Quote:

Originally Posted by miz
can you give more info about your host ?
like php version and Os

Quote:

Originally Posted by Revan
Host is running php4/a linux distro/apache1.3

And no, safe mode is off... :ermm:
Thanks for the effort :)


All times are GMT. The time now is 11:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01565 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete