tags:

views:

602

answers:

3

Hi guys..

I'm new to PHP development and I just used Zend yesterday. One problem I'm having is saving the file in a directory that is read-only.

I'm using Zend studio to develop PHP scripts. I have XAMPP installed in my Ubuntu in /opt/lampp/ directory.

Now the /opt/lampp/htdocs directory requires privilege access. I can't save anything there. It requires me to sudo everything. I know this is for security reason.

Now, I can just sudo gedit index.php inside the opt/lampp/htdocs/project directory and save the file there. But I want to use my Zend Studio to develop scripts.

When I opened the file inside /opt/lampp/htdocs/project/index.php inside Zend. I can't save it there. The save could not be completed because parent of resource is marked as read-only

Now I dont want to modify the directory to be read/write, I just want to use Zend Studio and allow zend to save files inside the directory.. Please guide me!

A: 

Run Zend Studio under the privilegies required to save to /opt/lampp/htdocs/?

PatrikAkerstrand
i dont know how to run zend studio in command line. i tried sudo zend index.php but it didn't work.
Keira Nighly
In Ubuntu, you need to find the *.desktop file for Zend - it will show you the command line to use. I don't have an Ubuntu box handy to find out where they are for sure, but I think they'll be in /usr/share/applications.
paxdiablo
+1  A: 

Okay, short of running Zend itself under sudo, I'm not sure you're going to be able to do that.

You're asking how to be able to write to a write-protected directory. The answer is "Don't try".

You'll either have to unprotect it or figure out a way to have Zend make a copy of the file in an unprotected area for editing, then copy it back (under sudo) when you close it.

I know which option I'd choose (I'm inherently lazy).

paxdiablo
Hi, yeah I used the latter technique. But can you tell me how to unprotect a write-protected directory? Then I'll just turn on the protected again once I'm finish editing?
Keira Nighly
Assuming you own the directory: "chmod u+w <directory>", then "chmod u-w <directory>" to revert. Or "sudo chmod 777 <directory>" to fully open it up but you'll need to know what to set it back to (e.g., if it was originally drwxr-x---, that would be "chmod 750 ...").
paxdiablo
Wow thats some hard to remember numbers. I'll note it in my tomboy notes! thanks!!
Keira Nighly
Keira, you just have to divide up the permissions: rwxrwxrwx is rwx (read,write,execute) for owner, group and other in that order. A single rwx is represented in binary where r represents 4, w represents 2 and x represents 1 - just add 'em together. Thats why rwxr-x--- is 750.
paxdiablo
A: 

helloo all, I have the same problem every thing are read-only inside Zend Studio for Eclipse

I Attempted every thing with no success!!

I can edit the php files from another editors like gedit and jedit but when I create php project every thing inside Zend Studio are Read-Only!!

any solutions??

thanks