PHP不会在Ubuntu LAMP Web应用程序中打开文件

I am working a LAMP web app running on Ubuntu 11.10. I followed instructions on the web to harden my apache, php and mysql.

I have a PHP script which work fine when I run from the command line under my own id. But when I put the scripts into the web app framework, it can't not even open a log file to write (in /tmp) and it can't read other files in /var/www/myapp/html as well.

I used Ajax to retrieve file contents on the server and then serve those files to the browser. So my url will look like: "php/myphpscript.php?arg=.......".

My directory structure is /var/www/myapp/html|php|js|cfg.

I know this problem has something to do with permission, security but I am quite at loss. Can someone describe what I need to do here?

Thanks,

I suspect you copied the files with your username, but apache executes as user www-data an thus has no access to your files. Either change them to belong to the apache user, or if you are the only develper on this machine, cahnge apache to run as you.