Apache - Write Access To A Directory On The Server?

May 5, 2009

I'm writing a simple web app in PHP that needs to have write access to a directory on the server, if the directory isn't writable I want to display an error message explaining to set the owner of the directory to whoever the webserver is being run as but as most people don't know this it would be nice to be able to tell them who to chown the directory to. Is it possible to find this from PHP?

View 7 Replies


Apache Linux Weird Permissions - Write To A File Using Fwrite() Inside My Server Directory

i ve been trying to write to a file using fwrite() inside my server directory. i am using this code:

Code: [Select]ini_set('error_reporting', 'on'); error_reporting(E_ALL);
echo substr(sprintf('%o', fileperms('skata')), -4);
$fp = fopen("skata", "w");
fwrite($fp, "skata");

the only thing that comes up to the browser is: Code: [Select]0777 i have even pre-created the file "skata" in the diractory running as root and gave it permissions 777. i m not quite familiar with linux or apache permissions and i can tfigure out what's going wrong. i am running apache under fedora

View 14 Replies

Cron Job As A Different User - Apache Doesn't Have Write Access To Web Root

I need to call a script via curl in one of my cron jobs. The script needs write access to the web root. Apache doesn't have write access to my web root. How can I execute the cron job as a different user?

View 2 Replies

Check Whether Apache User Has Write Privileges On A Directory (for Linux And Windows)

how to check whether apache user has write privileges on a directory using php for both OS (linux and windows)

View 1 Replies

File Permissions - Give Write Access To A Directory?

I'm trying to use PHP to create a file, but it isn't working. I am assuming this is because it doesn't have write access (it's always been the problem before). I tried to test if this was the problem by making the folder chmod 0777, but that just ended up making every script in that directory return a 500 error message until I changed it back. How do I give PHP write access to my file system so it can a create a file?

Edit: It is hosted on Hostgator shared hosting using Apache. Edit 2: Someone asked for the code: The code is a GD image script. I know the rest of it works as previously I was creating the image every ime it was called. Now I am trying to create them when new text is added and save them to a folder. The write line I have is:imagejpeg(null,$file,85);

I also created a test file to check if it was just a broken script (mainly copied from tizag):[URL]..(I don't know if/how to post the code here properly. Here is the contents of the PHP script, minus PHP tags.) It returns 13,13,1 (separate lines), so it looks as if it thinks it wrote something, but the testfile.txt is blank (I uploaded a blank one), or non-existent (if I delete it). Edit 3: The server runs CentOS.

View 5 Replies

Apache On Windows Server Can't Write To File

We have installed Apache 2.2 on a windows server 2003.

We want to make apache able to write to files on the disk but we don't know as what user Apache works as.

How do we allow Apache to write to files on a Windows server 2003?

BR Larre

UPDATE: The user is running as 'SYSTEM' and we have tried giving that user full permission to all folders and files. Also we have given 'Everyone' full permission to all folders and files. We have restarted Apache, cleared all cookies, restarted IE and still we get a message, from phpMyAdmin, that we don't have write permission.

View 3 Replies

Alias In Apache Server Have To Write Option Indexes To Directiory?

When I don't give indexes option I all the time have forbidden message.When I give this option it works well, but I don't have starting page, but page with head: "index of" and below it there are links to files, which are in my directory.Now, how to do, that I will have starting page? Without error.

View 1 Replies

Access SQL Server 2008 From 5.3.6 And Apache?

I struggle for a few days now to install xampp and run testlink 1.9.2 but using a SQL Server database. the problem is that php 5.3 does not use php_mssql.dll and it doesn't even let me use the older one either. someone mentioned I could use jtds, but I do not need, want or have java installed on that server.

View 2 Replies

Apache Server Is Not Able To Access From Other System?

I have a static Ip address. I configured all my projects in my apache server. And i put my apache server in online mode i'm not able to access my projects from other system. I'm using wamp apache server version 2.2.8. and windows 7 os. How can i able to access my projects from other system??

View 2 Replies

Access Data On Apache Server Using Xampp?

i am writing an iphone application, which basically uploads and downloads Images to/from a server. in order to test my code i installed xampp and everything works fine now. if i upload an image the server creates a folder named with the UDID-number of the device(via the http-method POST a php script is called).but if i enter the directory of such a folder and the name of the image in the browser i can see it in the browser.i am a newby on this topic and have no idea if there are better possibilities. my questions are: should i use databases where i save the images or is it just fine to create folders via a php script and save the images into these folders? can i hide all the datastructure, such that you cannot access it via a browser but only with the iphone application? (the application should only be able to download pictures randomly).

View 1 Replies

Apache - Access To Content Disposition Header In Server?

am doing some debugging in php and I need to take a look at the full headers sent to the server in including the multipart form-data information stored in content disposition.However apache_request_headers() doesn't return that information.I am also happy to look at a non php solution if possible

View 2 Replies

Make Directory Inside Htnl Folder In Apache Server?

i am trying to use mkdir command. i am trying to create a folder under /var/www/html/some-appication . i get permission error. i need to create a folder in some-application folder . what steps do i need to take before doing it.

here is the command i am using

$structure = '/var/www/html/'.$patientId;
if (!mkdir($structure, 0777, true))
die('Failed to create folders...');

View 2 Replies

"users" Write Access In A Directory?

Cannot start session without errors, errors given in your PHP and/or webserver log file and configure your PHP installation properly.Was a windows permission problem.Had to allow "users" write access in a directory.

View 5 Replies

Access Active Directory (of WINDOWS SERVER 2003) Via LDAP

I want to read user information from the microsoft windows 2003 server.

In the windows server 2003, i've create a domain, called "wissenskolleg".
I've assigned a password to it.

Now, i want get access to the Active Directory with PHP.

My code:


Always I've get the following error message: warning: ldap_bind(): For
Unable ton bind tons of servers I've found out, that $ds always return: Resource id #2 If i changed "wissenkolleg.com" in "whyitis", it is all the same, i've can only read: Resource id #2 and the same error with ldap_bind.

View 1 Replies

Download Folder From Some Ftp Server Into Your Server Home Directory And Give To That Directory Rights?

how to download folder from some ftp server into your server home directory and give to that directory rights? (like all files in this directoy have all or non rights...) not using special libs if it is possible.

View 2 Replies

Apache - Block Direct Access To A File Over Http But Allow Script Access

I'm loading my files (pdf, doc, flv, etc) into a buffer and serving them to my users with a script. I need my script to be able to access the file but not allow direct access to it. Whats the best way to achieve this? Should I be doing something with my permissions or locking out the directory with .htaccess?

View 2 Replies

Include Or Require A File From A Protected Directory And Maintain The Directory's Access Control?

I have an htaccess protected directory and I'm accessing a file in it through a require "admin/admin.php"; command (admin being the protected directory). I was hoping for the username and password popup window, instead I got direct access to my file.

Is there another way to include or require a file from a protected directory and maintain the directory's access control??

View 1 Replies

Blocking External Access To Directory But Allowing SSI Access

On an old site, where i was using PHP, I had a .htaccess in directory /noaccess as follows:

# /noaccess/.htaccess
<FilesMatch "^.*$">
order allow,deny
deny from all

And I had a PHP file like,

<?php include('noaccess/blah.ssi'); ?>

This works fine and the contents of blah.ssi is visible. However, on my current site I'm using SSI and the following:

<!--#include virtual="noaccess/blah.ssi" -->

does not work. The logs show unable to include "noaccess/blah.ssi". Remove the FilesMatch directive and it works. So I'm obviously misunderstanding how that command works, I didn't realise it would block Apache itself. So how can I block access from the web but allow SSI access? (I thought I could (and should) store the stuff I don't want accessed outside of public_html but that doesn't seem to work either in the SSI include - but anyway, even if it did, I'm interested to know how to do this).

View 1 Replies

Server To Server - Retrieve And Extract A Remote Zip File To Local Server Directory

I have a wp plugin file on server B who's purpose is to retrieve a zip file from a remote server A. Once Server B receives the zip file, it should extract the contents and copy the files into a specific folder on server B overwriting any existing files. I have some code below that I've borrowed from a file that uses and uploader to do the same thing and I'd just like to redo it for the automated server to server procedure described above. But I'm getting a fatal error when trying to Activate this plugin.

function remote_init()
$target = ABSPATH.'wp-content/themes/mytheme/';
function openZip($file_to_open, $debug = false) {
global $target;
$file = realpath('/tmp/'.md5($file_to_open).'.zip');......

View 2 Replies

Virtual Directories? Scripts Directory Nor The Php Directory Physically Exisit On The Server

I have seen websites that use a sort of "virtual directory" system...

Lets say when you click on something it goes to

Neither the scripts directory nor the php directory physically exisit on
the server, does anyone know how this is done?

View 6 Replies

Apache Php Write Permissions

I have two webservers. I can run php code fine on one but not the
other. Both webservers can read files only one can write. I have looked
around at other posts and they point at not giving permissions to the
apache user.

I have chmod 777 the directory /var/www/html and the subdirectory test:

View 2 Replies

Apache Needs Permissions To Write In

I have a script designed to read a number of images and make thumbnails of them. These thumbnails are stored in /thumbs/ as tn_filename.jpg. And so apache needs permissions to
write in ./ so it kan create thumbs and the files therein.

But I also want to upload pictures directly to ./ with FTP/SSH without logging in as apache. Code:

View 6 Replies

Get Session To Write To Apache

I switched servers recently, and now my home page won't work. It gives the following text:

Warning: session_start() [function.session-start]: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/alt.alternativedc.com/httpdocs/index.php on line 6

Warning: Unknown: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0

I assumed that this meant that the session folder was not writable, so I ran the following command after I ssh-ed into the server:

chmod o+rw /var/lib/php/session

View 1 Replies

Giving Write Permission In Apache?

I have a PHP script that writes a JSON file based on values retrieved from $_GET.


Those are the permissions given to the root server folder. What do I need to change to allow PHP to write the file?

View 5 Replies

Connect Local Directory(on Server) To Remote Directory?

for example, i have 2 servers. one ofs ip and the other ones i have upload directory on both servers. can i connect first's upload directory to second one.

PHP Code:

copy ("tmp/1.jpg","upload/1.jpg");

this code works on both servers. but i want that, if i run this command on first server, 1.jpg must send to second servers upload directory. is this possible? i googled and found something about virtual directory, ln command. but its not solving my problem.

note: servers are litespeed.

View 3 Replies

Java - Upload Images To Server / Write Server Side Code To Handle The Http Post Request?

I have few images that I want to upload to my server. The client side is written in Java, and I will be making a HTTP Post request to upload images. Do I need to write server side code to handle the http post request? If so, where can I find some examples? The server supports PHP and Tomcat.

View 2 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved