Apache Virtual host Wml,apache, and PHP introduction

Source: Internet
Author: User
Tags php compiler php introduction
In the company's website, I found that I need a wireless to receive my email, stock market information and so on. Don't want to pay people to get the information I want, I decided to develop a wireless website. Such information is not a problem on the Internet, but it is scattered too hard to collect. I need to be able to execute PHP, access the repository, and I need PHP to do another function for me. This article covers the basics of WML, how to build your Apache Server and PHP. These foundations allow you to build your environment and learn your own future applications.
Needs
You have a bit of experience with Apache Web Server, Php and HTML. For the system requirements, I was using Apache 1.3.9, PhP3, and Red Hat Linux 6.0来 demonstration. I haven't encountered any problems running Apache on Windows, and PHP3 or PHP4.
In this article, I will guide you in the field of exposure: WML introduction, set up wireless appications on Apache, and build your first wml/php Web page. Most of the information can be collected from the Internet.
Introduction to WML
WML represents the wireless markup language. WAP phones or similar devices are used in WML-written web pages. WML is based on its syntax and scrictness similar to XML. Anyone who has used HTML will not have a problem learning WML. Many tags and attributes are the same, and there are not many tags. WML allows program developers to develop dynamic content, although for this article we will use PHP as a dynamic language.
WML Basics
In WML you can use many sub-pages (called "cards") in a WML page (called "Deck"). Each WML card acts like what is displayed in the Web page. The following will be examples of our. WML pages. On my Server, I stored this file in ~/wireless/home.wml.
 

My first Test page




Unlike HTML, if you don't colse tags, for example , your code will not be correct. This example generates a simple test message "My first test page" on any wireless device.
Set Apache
OK, now the interesting part. In order for Apache to catch a wireless device to visit your server, you need to build your httpd.conf (my file is located in the/etc/httpd/conf/) file and I use PHP3 so all the changes will be recorded. Before you start, you can back up your httpd.conf file, just in case:)
Step 1: First, we need to add a new MIME type to the AddType feature. You'll need to go to the Script you defined in PHP. Looks like the following:

AddType application/x-httpd-php3. php3. php. phtml
AddType Application/x-httpd-php3-source. Phps

To change to:

AddType application/x-httpd-php3. php3. php. phtml. WML
AddType Application/x-httpd-php3-source. Phps

This will use PHP compiler in all the. WML pages.
Step 2: Remove mark (uncomment) Apache Load module and ADD module
Change:
#LoadModule Rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c
Yes:
LoadModule Rewrite_module modules/mod_rewrite.so
Addmodule mod_rewrite.c
Step 3: Use Apache mod_rewrite module (only for 1.2+ version above). With this, you can instantly rewite the requested URL (when the conditions are met). This fragment needs to be stacked at the bottom of the page.
Rewriteengine on
# Catch Most WAP browsers
Rewritecond%{http_accept} TEXT/VND\.WAP\.WML [OR]
# Winwap, Wapjag
Rewritecond%{http_user_agent} WAP [OR]
#Nokia emulators (SDK)
Rewritecond%{http_user_agent} 7110
# Rewrite to where your wireless page is located
Rewriterule ^[\./] (. *) $/HOME/MYDIRECTORY/WIRELESS/HOME.WML [L]
Now you want to restart Apache server.
Generate your first wireless wml/php Web page
Ok, now that we have everything ready, let's set up the first page. In order to function properly, you need to send the correct header information.
# Send the header information

Header ("CONTENT-TYPE:TEXT/VND.WAP.WML");
?>
# put in the WML code



My First test page




You have just completed your initial "simple" wireless Web page. Now, let's try to do something more difficult.
You need to check your WAP-compatible website device. I use the Phone.com Software Development Kit, which contains up. Simulator, you can check my wireless Web page. Choose a different phone and look at their wireless web pages through different devices when it looks like long.
More information in:
http://updev.phone.com
http://www.wapforum.org
http://www.wap.com
/http Www.waplinks.com

Above introduces the Apache virtual host Wml,apache, and the introduction of PHP, including the Apache virtual host content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.