Thanks for the informative post, Lowell & Marek. Our host suggested chmod-ing necessary directories via ftp. Completely defeats the purpose of my app which is supposed to allow the client to maintain the site themselves; not have me mess around with directory/file perms -- uggghhhhh....
In any case, I'm more than a little frustrated that the app works like a dream locally; now, I have to hack around to get it working live. I'm not a huge fan of the latest version of php now either. I was able to open external files (e.g. http://somesite.com/index.php) with fopen(); no such luck in this realease. Getting a freaking "php_hostconnect: connect failed" error message now. My mood is down the tubes at present -- waiting for some divine inspiration as my efforts to slog it out have me stewing...... --Noah "Lowell Allen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On my local machine (win2k pro, apache), no problems -- everything works > > just as designed. > > > > Today I began testing on the live server; i.e. my client's hosting company > > (linux, apache 1.3.27, php 4.3.1) -- that's when the trouble started. > > > > The site builder app builds static pages based on changes made by users in > > our online administration center. When I test out creating a new site > > section; i.e. triggering my make_file function(writes page content to new > > file) I receive the following error: > > > > Warning: fopen(/local_server_path/file_to_create.php) [function.fopen]: > > failed to create stream: Permission denied > > > > I've attempted to chmod(777) my testing directory via ftp client, which > > appears to work; however, when I fileperms($file_in_test_dir), I get > > chmod(644), so clearly I'm not the owner. > > > > Pardon my ignorance here, but I as yet know little about dir/file perms. > > Should I contact the host and have them give me sufficient permissions? > > If you create a subdirectory of the root level public HTML directory, then > PHP can create files there, but not in the root level directory. If you > change permissions to 777, PHP can create files there, but it's not a good > idea to have the permissions that wide-open. > > You might be able to get your commercial host to change who PHP is running > as from "nobody" to your login identity, then PHP could write to the root > level directory, but you might not be able to -- my main host says they're > changing policy for security reasons to not allow that. > > You could put the static files in a subdirectory where PHP will have > permission to create files. But this might require lots of reworking links > depending on your site design, and thus not be a viable option. > > You could set up a PHP script to be executed by a crontab as a CGI. Done > this way, PHP can write to the root level directory. This is what I did > recently for a similar problem. The content management system provides a > link for updating static HTML pages. That link (script) writes info to the > database, flagging an update request. Every 5 minutes, a crontab calls the > PHP CGI script that actually does the update. The script checks the database > flag and does the updates if they've been requested (flagged). > > Bottom line -- discuss the problem with your commercial host and see what > they suggest. > > -- > Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php