R
E
S
O
U
R
C
E
S
       Home      Products & Services      Contact Us      Links


WebHatchers will design & develop your site for you.
_______________________

Website Menu Heaven: menus, buttons, etc.
_______________________

Send us your questions.
_______________________

site search by freefind
_______________________

HOME
SEO, Google, Privacy
   and Anonymity
Browser Insanity
JavaScript
Popups and Tooltips
Free Website Search
HTML Form Creator
Animation
Buttons and Menus
Counters
Captchas
Image Uploading
CSS and HTML
PHP
AJAX
XPATH
Website Poll
IM and Texting
Databases—MySQL
   or Not MySQL
Personal Status Boards
Content Management
   Systems
Article Content
   Management Systems
Website Directory
   CMS Systems
Photo Gallery CMS
Forum CMS
Blog CMS
Customer Records
   Management CMS
Address Book CMS
Private Messaging CMS
Chat Room CMS
JavaScript Charts
   and Graphs




Free Personal Status Boards (PSB™)

Free Standard Free PSB

Free PSB Pro Version

Free Social PSB

Free Social PSB Plus (with Email)

Free Business PSB

Free Business PSB Plus (with Email)

PSB demo

Social PSB demo

Business PSB demo

So what's all this PSB stuff about?

Chart comparing business status boards

PSB hosting diagram

PSB Licence Agreement



Copyright © 2002 -
MCS Investments, Inc. sitemap

PSBs, social networking, social evolution, microcommunities, personal status boards
PSBs, social networking, business personal status boards
website design, ecommerce solutions
website menus, buttons, image rotators
Ez-Architect, home design software
the magic carpet and the cement wall, children's adventure book
the squirrel valley railroad, model railroad videos, model train dvds
the deep rock railroad, model railroad videos, model train dvds

Write Nearly Any Type of File with PHP

PHP can write just about anything. The only type of file missing from the list below is PDF file, and, yes, PHP can write those too if your host server's PHP installation has the PDFlib library installed. Our host doesn't have it, but the above link will tell you what you need to know. If you need PHP to write DOC, XLS, or RTF files, try http://www.ozzu.com/programming-forum/php-create-word-document-t65376.html. See below for just about everything else.

Permissions

The one thing you need to watch here is permissions. On some servers, you need permissions (CHMOD) set to 755 to use the PHP fwrite function, which all the file creations below use in their code. But on other servers (like ours, we discovered), you need permissions set to 777. There are people that understand why. We are not those people, nor is our server host. Older servers seem to need 777. Newer servers need only 755—which is obviously more secure. But this is not a hard and fast rule—your mileage may vary. If you find that you need 777, you may find your host blocks this setting. But you may find you can fwrite with only a 755 CHMOD (public_html AND the PHP script file setting). Some hosts disallow fwrite and even PHP file functions in general. Here is what to do if you are testing a PHP script for writing a file and you get the dreaded permission error message:

  1. Close your browser and FTP program and restart them.
  2. Before going to your PHP script page, clear your browser cache, which is found in different places depending on which browser. On IE8 it is in Developer Tools on the Tools menu, and on IE6, on the Tools menu, click Internet Options, which opens to the General tab. In the Temporary Internet Files section, click the Delete Files button. In Firefox, on the Tools menu choose Options, then the Network tab. Click Clear Now in the Offline Storage section.
  3. In your FTP program, reset the appropriate permissions, which may also be referred to as CHMOD. In SmartFTP, for instance, right click the public_html folder and select Properties and replace the current number in the permissions box with 755. Then do the same with your script's folder, and then do the same with the script file itself.
  4. Clear the cache one more time for good luck.
  5. Get to your script page and load the page in the online browser, then reload it again with F5 for good luck.
  6. If the script will not fwrite, and you see permissions errors, do all the previous steps again, substituting 777 in place of 755 for CHMOD settings.
  7. If still no go on getting the PHP fwrite function to write, ask your server host if he has either of these two things disabled: fwrite or similar PHP file creation functions, or permissions beyond 755 which allow Other or Group to Write (755 allows only User—you—to Write). If he tells you it is for security, he is correct: file creation functions are a bit iffy in the security department. See if there is any way you can get the disablement undone at least temporarily. But if you need to be able to do this type of thing but the host won't budge, your only option is to either find a host who is willing to let you do it, or install Apache and then install PHP on your hard drive and host it yourself. You will also need to find out if your internet service provider (ISP) will allow you to run websites on your home computer. If not, you have to use a different provider.
  8. Are you sure you need PHP file creation functions that much? :) :D lol

Why Write Files?

So why would anyone want to fwrite files anyway? There are a lot of file handling functions in PHP and plenty of places to learn about these filesystem functions. Reading, creating, copying, moving, uploading—there are plenty of file tasks that can need doing. And while most of us simply do these with our Windows Explorer or 2xExplorer file management programs and Notepad or Editor2 (our favorite), or FTP programs like SmartFTP, sometimes we need to do it on the fly online, or empower others to do it online. The above links lead to dozens of file functions that are in servers' PHP installations for our use.

But there are times when you just need to use PHP to write various types of files. The list below shows you how—it's not hard at all. There are even five PHP scripts for creating graphics/image files. For image creation, we concentrated on the simple task of allowing users to input text and using PHP to take this text and put it in a nice box with a border and save it as a graphics/image file. Let us know how you like these scripts! We kept them as simple as we could so you could get the idea in a flash.