473,698 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I change folder/file property CHMOD from PHP script

nallinattu
11 New Member
How do I change CHMOD of a folder / file through a PHP script ?
(I do not want it done by an FTP client )
Many a times I have had problem to change CHMOD of a file but when I empty the folder and apply CHMOD to all contents of folder (sub folders and files ) I get what I want . Why am I required to do this in a round about way ??
Jan 13 '07 #1
1 4152
b1randon
171 Recognized Expert New Member
How do I change CHMOD of a folder / file through a PHP script ?
(I do not want it done by an FTP client )
Many a times I have had problem to change CHMOD of a file but when I empty the folder and apply CHMOD to all contents of folder (sub folders and files ) I get what I want . Why am I required to do this in a round about way ??
You can do a CHMOD as follows:
[PHP]
$output = `chmod a+rwx file.txt`;
[/PHP]
The result will be stored in $output. You should note that this won't work in safe mode.
Jan 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
13091
by: OllimaX | last post by:
Hi! My trouble might be simple, but I'm quite new to php, and, perhaps I'm even more simple. It's that I had to chmod 777 two folders to get my scripts do what I wanted them to do, and I don't like it. I have a script running on my ISP's unix-apache -server. It is to read string from a form, and create a text-file in a subfolder 'txt' from it. The essential parts of the script is here:
3
4575
by: Max | last post by:
Hi, What is the best way to change passwords via php? I was first thinking of using the chpasswd function, but even though I added an entry for apache to be able to run chpassword vi visudo, but I still get the following error: chpasswd: can't lock password file
3
2705
by: Alf Laue | last post by:
Hi, how do I delete a folder at my ftp-server, that was automatically created through a installation script? I dont have the permission to delete that folder :-( Thx for your help Alf
5
16777
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true and no files are deleted in the folder. The peculiarity of this issue is that the files/subfolders cannot be seen through the windows explorer either. I can only access/delete them through a command shell. Any ideas?
4
4826
by: Ian N | last post by:
Hi i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and view the image. I've tried adding the following line: - chmod($uploadfile, 444); and also a few variations on it but to no avail.
6
1718
by: jonathanmcdougall | last post by:
I have read many posts on this subject and found no satisfying answer. I am creating a file on the server via a PHP script. The file is created using GD (imagejpeg()), though I don't think it is specific to GD. Here is what I understand so far: 1) a PHP script runs in the webserver user space. In my case, this is 'apache', though I think 'nobody' is quite frequent also. 2) creating a file from the script makes the "current" user its...
16
2038
by: Giggle Girl | last post by:
Hi there, I have a nav tree similar to the XP Windows Explorer in behavior. It uses styles to underline a row on mouseover, and change the look of a row when clicked. Currently, it is working fine using CSS/Javascript, by calling functions that underline and highlight by passing in IDs. The problem is, I do not want to pass in IDs. Currently it has one the TDs to be changed, but I may need to add one for images (to change the
2
5307
by: webandwe | last post by:
Hi, I am trying now for the last 2 weeks to get a $!*@ script to change all my files under one folder to 644. Can someone please help me or just give me a script you have cause I am now fed up with this stuff not wanting to work. Thank-you $file = all my files in my images folder or this directory
2
10094
by: webguy262 | last post by:
I'm trying to troubleshoot a membership script. The script is attempting to write to a file called .fdaccess. The function that's throwing the error is in a file called htpasswd.php. Here's the fuinction: function save($file=false){ $fcontents = ""; if($file == false) $file = $this->_path; foreach(array_keys($this->users) as $user){ $fcontents .= $user.":".$this->users."\n";
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.