PHP script: Script not writing .txt file

software development

#1

I have set up a Flash-based form that collects the user’s entered information. The first PHP script, SendEcard.php, then calls the variables and writes them to a .txt file. The second PHP script, SelectCard.php, uses the information from the .txt file to send out an E-card with the user’s information written to the card. Here is a working example: http://artelius.com/Ecards/testcards.htm

Once you fill out the information and click the send button, you should receive an email with a link to your E-card. The E-card will have your name, message, etc. that you entered in the online form.

This example has a directory, “dBText”, which is assigned 777 permissions. The dBText directory is where the .txt file is written by the SendEcard.php.

I have read that 777 permissions are not good for security reasons and have tried to create another E-card using 766 permissions for the “dBText” directory. Here is the example: http://artelius.com/EcardsTest/testcards.htm

This example will collect the information in the .txt file, however, it won’t write the text to the E-card.

I created the “dBText” directory using different methods (Fetch, using ssh and then chmod 766).

Why would assigning a directory 766 permissions prevent the file from accessing the .txt file? Am I missing something?

Thanks,
Angela


#2

If you’re running in FCGI/CGI mode (under PHP), you might find that you’ll have to set all files/folders to executable (+x or 0777). You might try that at least first, to see if that’s the issue. Otherwise I’m not entirely sure myself…


Chips N Cheese - Custom PHP installs and the like!


#3

if your scripts work with permissions set to 777 then why not use php to change the permissions on the fly? provided php is running under the same owner as the folder you shoudl be fine.

remember to use umask() with chmod in php