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

SEO, Google, Privacy
   and Anonymity
Browser Insanity
Popups and Tooltips
Free Website Search
HTML Form Creator
Buttons and Menus
Image Uploading
Website Poll
IM and Texting
   or Not MySQL
Personal Status Boards
Content Management
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

PHP Script for Writing ASPX Web Page Files

PHP can write just about anything. The script below will concentrate on ASPX website pages.


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. You will find that write-nearly-any-type-of-file-with-php.html is the best place you can go for answers if you are testing a PHP script for writing a file and you get the dreaded permission error message.

Writing Various Types of Files

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.

The PHP Script for Writing ASPX Web Page Files

First, notice that we used single quotes inside the $p string (in the response.write function) since double quotes would conflict with the double quotes the $p string is surrounded by. And of course, the newline characters are escaped (\n). We will look at ASPX in a second. But first, let's check out the PHP aspects of the script. The $p variable is most of the script (12 lines long!). After the closing tag for HTML is a " character. That is the end of the PHP string with the variable name $p. Next we use fopen and put in a file name and a w for write. Then we use fwrite to write the file. Next we use fclose, which you should always do when using PHP file functions. Finally we CHMOD the permissions to a nice safe 644. A created file may be getting this CHMOD by default anyway, but why take chances? Of course, your host may not allow CHMOD from a PHP file anyway. Some do; others don't.

So that takes care of the PHP, which simply writes an HTML file whose contents are what's in the PHP variable string $p.

Now, what about the ASP.NET web application framework, using the ASPX extension, originating from Microsoft? ASP.NET is Microsoft's next step up for server driven web pages. Rather than adding to ASP (.asp) to add new functionality, ASP.NET (.aspx) is a nearly total rewrite, providing a programming interface that allows developers familiar with Visual Basic and other Microsoft based client-server development tools to program for the internet. Some say it is an object-oriented programmer's dream. Is it used by the big players?

Facebook, Youtube (uses Python too), Yahoo, Wikipedia, WordPress and Baidu are written in PHP. Live and MSN and MySpace are ASP.NET websites. Google uses Python and C++ with lots of Ajax for page display. Twitter uses Ruby on Rails and Scala. Amazon.com, bbc.co.uk, Priceline.com, and Craigslist use a lot of Perl. Yahoo benchmarked their own compiled custom-C language against PHP+eAccelerator and Perl+FastCGI, and found that the difference wasn't very large. So they chose PHP as their primary development language. Java is used in Google's Gmail. Oracle (Java's owner) has a section on their site entitled Why Businesses Are Choosing Java, yet not a single example of such a business is given, but we found that Dell, NewEgg, and Buy.com use it.

Yet Microsoft insists that: "Develop, deploy and easily manage Web applications using your choice of languages. From ASP.NET to PHP, IIS7 provides a powerful and flexible Web server environment for the world’s most popular Web applications. IIS7 provides a single Web server platform for developing, deploying, hosting and managing the most popular languages used on the Web, from ASP.NET to PHP." One gets the idea that they are seeing which way the wind is blowing and wish to get in the flow, so they are pointing to running PHP even while pushing ASP.NET. Notice that Apache servers do NOT talk about running ASP classic (.asp) or ASP.NET (.aspx). Only Windows servers can run ASP installations. And you need the necessary licenses, which are not free.

If you do not already have Microsoft programming experience, ASP.NET hosting is probably not your best choice, especially because of the extra hassle and expense. ASP.NET officially requires that you use IIS. Unfortunately, IIS has a long history of security holes, which makes many administrators skittish about using it to handle their web sites. Whether these security holes are because of Microsoft's ineptness or because IIS servers are red flags to hackers is irrelevant. The critical issue is that they exist and they create risk.

But in ASP.NET, the pages are always compiled into .Net classes housed within assemblies. This class includes both the server-side code and static HTML, so when the page is accessed for the first time, subsequent rendering of that page is serviced by executing the compiled code. All the inefficiencies of the scripting model of traditional ASP are eliminated by this. These .Net classes run fast. Sometimes even faster than what Zend optimization can do for PHP. But PHP is without a doubt a very speedy server-side language.

One other thing: The PHP imagegrabwindow() and imagegrabscreen() functions are only available on Windows servers. If you need/want to do a lot of screen or window capturing work because you need to take snapshots of web pages for whatever reason (such as creating thumbnail images for some application or client), these PHP functions and a Windows server are really the only way to go. We'd sure love to see Apache allowing these functions, but they probably feel they are too server intensive, although they reportedly grab screens in only 2 or 3 seconds so perhaps it's only a long series of such function executions they're concerned about.

Here is the result: my_aspx_file_written_with_php.aspx

IMPORTANT NOTE: To see anything on an ASPX page, your server must be running the Microsoft IIS (Internet Information Server) operating system, version 3.0 or higher. If not, you will not be seeing what the ASPX page contains, no matter what.

<title>my aspx file written with php</title>\n
<% response.write('<h2>ASPX page test</h2><P>To see anything on an ASPX page, your server must be running the Microsoft IIS (Internet Information Server) operating system, version 3.0 or higher. If not, you will not be seeing what the ASPX page contains, no matter what.</P>') %>\n
$a = fopen("my_aspx_file_written_with_php.aspx", 'w');
fwrite($a, $p);
chmod("my_aspx_file_written_with_php.aspx", 0644);