0

I can't understand how to save directory location.

The script is located in some subfolder of root one. Here is the example tree:

|-index.php
|-another.php
|+empty_folder
|+subfolder
|---script.php

I'm running from script.php. I have to save in database path for the empty_folder. In script I use the code:

if (is_writable($PATH)) ...

And it returns error every time (can't open the folder). Now $PATH looks like ../empty_folder and this doesn't work.

Any ways?

2
  • What is the current working directory for script.php? echo getcwd(); Commented Sep 20, 2011 at 21:26
  • @sitesafenl /srv/http/wordpress/wp-admin and I need the wordpress folder access. empty_folder is there. Commented Sep 20, 2011 at 21:29

2 Answers 2

2

Instead of ../ try the use of the full path: if(is_writeable('/srv/http/wordpress/'))

Sign up to request clarification or add additional context in comments.

1 Comment

Okay, thanks. I got the $_SERVER['DOCUMENT_ROOT'] and built the path.
1

is_writable only returns false if the specified path cannot be written to by the current user ID. That can be because the path doesn't exist, or the current user ID doesn't have the writes to write there.

What are the permissions on empty_folder (user/group + permissions) and what userID/groupID is your script running under (web server's?).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.