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?


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

May 28, 2011

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 View Related

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

Mar 11, 2011

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 View Related

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

Mar 18, 2011

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

View 1 Replies View Related

File Permissions - Give Write Access To A Directory?

May 24, 2010

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 View Related

Apache On Windows Server Can't Write To File

Mar 27, 2009

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 View Related

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

Oct 5, 2010

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 View Related

Access SQL Server 2008 From 5.3.6 And Apache?

Apr 4, 2011

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 View Related

Apache Server Is Not Able To Access From Other System?

May 26, 2011

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 View Related

Access Data On Apache Server Using Xampp?

May 28, 2011

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 View Related

Apache - Access To Content Disposition Header In Server?

Apr 22, 2010

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 View Related

Make Directory Inside Htnl Folder In Apache Server?

Aug 9, 2010

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 View Related

"users" Write Access In A Directory?

Feb 1, 2008

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 View Related

Access Active Directory (of WINDOWS SERVER 2003) Via LDAP

Feb 28, 2006

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 View Related

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

May 10, 2010

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 View Related

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

Apr 21, 2010

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 View Related

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

Feb 26, 2003

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 View Related

Blocking External Access To Directory But Allowing SSI Access

Dec 17, 2010

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 View Related

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

Feb 22, 2010

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 View Related

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

Jul 17, 2005

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 View Related

Apache Php Write Permissions

Jul 17, 2005

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 View Related

Apache Needs Permissions To Write In

Jul 16, 2005

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 View Related

Get Session To Write To Apache

Jul 8, 2011

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 View Related

Giving Write Permission In Apache?

Mar 18, 2011

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 View Related

Connect Local Directory(on Server) To Remote Directory?

Jun 21, 2011

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 View Related

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

Dec 30, 2010

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 View Related

Apache2 - Write An Apache Protocol Handler ?

Oct 22, 2010

I wonder if and how it is possible to write a custom "protocol handler" (listening at a custom port) for Apache 2 in PHP?In C and mod_perl you can write so-called "protocol handlers", which intercept the early Apache stage (after a client socket connection has been accept()ed, but before any content has been written to it) and can for example handle FTP or SMTP protocols. Is it possible in PHP as well?

For example, I have the following simple mod_perl handler, which I'd like to port to PHP (to compare the memory usage - since my mod_perl-handler needs 20m per child). My handler listens at the port 843 and writes the string POLICY to the client socket:package SocketPolicy;

# Run: semanage port -a -t http_port_t -p tcp 843
# And add following lines to the httpd.conf
# Listen 843code]..........

View 4 Replies View Related

Apache - Write Mod_security Friendly Code?

Jun 11, 2010

I made a theme in WordPress which hit the mod_security rule on HostGator and gave 403 error.

I contacted people there(at HostGator) and they fixed it for me. But I don't want my theme to work like this.

I just wanted to know if there are any guides/blog post/tutorials telling about writing PHP code which is mod_security friendly?

I tried Google, but didn't find anything helpful.

View 1 Replies View Related

Write Permission With Directory

Jun 11, 2006

i want to know the functions that control the read, write and execute permission in a directory? what are those commands that do these?

View 1 Replies View Related

Write Files To A Different Directory?

Jul 24, 2010

Possible Duplicate: PHP write outside document root assume i have a script in somewhere in the htdocs directory and i want this script to write files in a directory that is of the same parent as htdocs. how do i do it?

View 1 Replies View Related

Data - Read A File On Server A Write To Server B?

May 4, 2011

I want to pick up series of files from a file production server and move extracts to development server nightly. Servers are IBM running db2. I can use native drivers or ODBC.

I was thinking about using php. One option was to iterate through source file and insert to development server. Another idea was read source file into array and then iterate array and write to development server.

View 2 Replies View Related

Write The Contents Into A Newfile In A Different Directory.

Apr 15, 2002

I am opening a file copying the contents and trying to write the contents into a newfile in a different directory. but its not working.

if ($handle = opendir('/home/jarntz/cdstuff/files')) {
//echo "Directory handle: $handle";
echo "Files:";
while (false !== ($file = readdir($handle))) {
echo "$file<br>";

$namelen = strrpos ($file, ".");
$name = substr($file, 0, $namelen);
print "$name<br>";

$filename = "/home/jarntz/cdstuff/files/$file";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

$ncontents = nl2br ($contents);
$scontents = "Test<br>" . $ncontents;
print "$scontents<br><br>";

$storefile = "/home/jarntz/cdstuff/html/" . $name . ".html";
print "$storefile<br>";
$myfile = fopen ($storefile, "w");
$fp = fwrite($myfile, $scontents);

View 2 Replies View Related

Selective Permission To Write In The Directory.

Jul 29, 2007

I want to create a publicly accessible php page which will generate
images (with the GD library) and store them in some directory. For
this I have to change the permission of directory (it has to be
writable for everybody). However, as far as I understand, this will
allow everybody to put in the directory whatever files. I would like
that only my php program has permission to write to the directory. Is
there any possibility to do that?

View 5 Replies View Related

Cant Create Directory (or Write File In It)

Jun 21, 2007

wSub.php is supposed to take a form and, based on the forms contents, create a directory and record the forms contents in that directory.

I know from testing with echo commands that the directory name and file name are good, but when I "uncomment" the code below which is supposed to create the directory and write the file, I get the errors that follow the code. Code:

View 2 Replies View Related

How To Write The Path From The Web Root Directory?

Jan 18, 2007

We have another servers harddrive mounted. You can view it on our server on the root folder in ftp. it is in the same folder as the /bin, /etc/, /var, and others. It has the name of mnt. How can I get a php script to see this folder? What path do I do?

What I am trying to do is upload a file to this folder. I know how to do the file upload, but I only know how to write the path from the web root directory, and nothing behind the root directory.

View 1 Replies View Related

Linux - Write To Directory Using It And Permissions

Mar 24, 2009

My PHP script writes to a file so that it can create a jpg image.

fwrite($handle, $GLOBALS['HTTP_RAW_POST_DATA']);
print $newfile.'.jpg';

I have put this script on a new server however the image never gets saved. The permission of the folder it saves to is 755 but it does not own it. Last time, I think I fixed the issue by changing the directory owner to apache as this is what PHP runs as. I can not do the same again because I am not root. Firstly., Is there another fix? Secondly, If I could change the owner of the directory like last time will this fix the issue?

View 4 Replies View Related

Starting Apache - Error "Apache HTTP Server Has Encountered A Problem And Needs To Close"

Dec 17, 2009

I have windows XP with service pack 3 machine. I installed Apache 2.2 and tested working fine. And then I installed php 5.3.1. When I start Apache, it doesn't start and not getting get following error. "Apache HTTP Server has encountered a problem and needs to close. We are sorry for the inconvenience." But I don't get any error in the log fine.After studing in detail, I found this enrty in httpd.conf

LoadModule php5_module "C:/php/php5apache2_2.dll"

But this file is already there in the folder. In windows event log; I found this entry Faulting application httpd.exe, version, faulting module php5ts.dll, version, fault address 0x000e619a.

View 1 Replies View Related

Write The Same Application Twice,without DB Access?

Feb 12, 2011

write the same application twice, once in php and once in java, for a class I'm taking at schFor curiosity I did a benchmark on the two and found that the java version was 2 to 20 times slower than the php version if the database is accessed, and 1 to 10 times slower without DB access.I see two immediate possibilites:I suck at java.I can finally tell people to quit whining about php.posted my servlet code here.I don't want any nit-picky whining or minor improvements, but can someone see a horrible glaring performance issue in there? Or can anybody explain why Java feels like it has to suck?

I've always heard people say that java is faster and more scalable than php, especially my teacher, he is convinced of it, but the more requests that are made, the slower java gets.php doesn't seem to be affected by increased loads but remains constant.

View 3 Replies View Related

Loaded Latest Edition Of Apache Http Server On XP, And Installed Php On That Server...

Feb 6, 2007

How do I run a .php program? (I'm starting with the "hello world" script)

View 18 Replies View Related

Apache - Fsockopen() : Local Test Server Vs Remote Server?

Mar 25, 2011

I'm hoping there is a quirk about apache/php that I'm missing.

The Code:

$servers = array(

What it does: check connectivity to a variety of minecraft servers with the fsockopen function.

The problem: This code does exactly what it's supposed to do on both my local and my remote web servers. However, on my remote server, the status always displays as DOWN even when I know they are UP, they also display as UP on my local server. I can't figure out WHY my host wouldn't be able to reach these servers, so I hope its a server quirk i don't know about. Maybe theres another way to effectively ping an IP in php that I could use? or maybe you know of a server setting that is effecting my connectivity.

View 2 Replies View Related

Read/write Access To All The Files

Sep 6, 2007

I recently made a php app for a company that spiders through a server and finds all files of a specified type (html, etc) and then opens the files and does specified things to them. So, the tool needs to be placed on the server and then it needs read/write access to all the files.

It works fine on my local server, but the client says that it fails (message is "failed to write to file" and then it stops). I told him to try it with ALL files and folders set to 777 just for testing purposes and he says that it's still not working. I have no idea what to suggest.

View 1 Replies View Related

Read And Write Into Access Database?

Jun 13, 2011

How to read and write into a MS Access database with PHP. I need just general explanation and code. I have experience with PHP and MySQL, but never writing to an Access database.

View 1 Replies View Related

Write "xampp_cli.exe Is Trying To Access

Sep 10, 2009

I downloaded the last version of xampp and when I am trying to start apache the comodo has many alerts that write "xampp_cli.exe is trying to access..." some programs in memory one is oracle.exe,lsass.exe ,svchost.exe etc and finally the apache does not start.I set the port at 8082 at httpd.conf as other port are used.

View 6 Replies View Related

Build Localhost Server Using Apache / MS SQL Server 2000?

Feb 25, 2006

i live in Vietnam, so My English is so bad, but i hope you know what i mean. I want to setup a server that use : Apache, PHP, and Ms SQL server persional edition 2000. But i only can connect Apache 2.0 and PHP 5.x it run ok But i don't know, the way that PHP can access MS SQL how to set up.

View 8 Replies View Related

Access A MS Access Database On A Linux Web Server?

Nov 3, 2009

Ideally it would be brilliant if I could upload an .mdb file to a linux webserver and query it using php. Is this possible? If so how?

View 3 Replies View Related