Beginner's PHP Notes

Source: Internet
Author: User
Tags arithmetic operators dot net file handling learn php php and mysql
Rookie PHP note July 15 about half an hour





General impression: PHP syntax is similar to the C language. I have heard of PHP and MySQL, but today only know that the original PHP and MySQL is not a fixed collocation, in fact, and Oracle and other databases can be connected, but it is common and useful MySQL.

(i) Configure the Apache server:

Always heard to use Apache and PHP collocation, now know that the original Apache can also be paired with ASP and JSP. Anyway, in order to learn PHP first to apache.org, download Apache installation package, of course, the next directly can install the version, and then learn the need to compile their own bar. The result conflicts with the original IIS during installation, because Port 80 is occupied, and IIS is temporarily uninstalled. Then everything went well, enter http://localhost/in the browser, the large "It works!" appears on the page. Indicates a successful installation!

Haha, the following can be a simple modification of the homepage. Find the default access directory, mine is C:\Program Files\apache software Foundation\apache2.2\htdocs. But this directory is too long, I want to change the default access directory to E:\php. Find C:\Program files\apache software foundation\apache2.2\conf httpd.conf file, find "DocumentRoot" To change the directory, but always met 403, I depressed, It's jammed here. Ah ah Ah!!! Look for a new version of the bug? Forget it, the purpose is PHP, and then change the directory back. Search process to find a good blog Oh, http://www.chweng.idv.tw/index.php. I'll call on you when you have time.

(ii) Installation of PHP:

The first of course is to download the zip package to http://www.php.net/downloads.php to download Windows binaries. Unzip to E:\php, change the php.ini-recommended in this directory to php.ini and copy to C \ Program Files\apache software foundation\apache2.2 directory, open php.ini, find Extension_dir = "./", modify to Extension_dir = "E:\php", will; Session.save_path = "\tmp" changed to Session.save_path = "E:\php\session"
...... Sleepy, the rest of tomorrow to say.






Rookie PHP Note July 16 about 1.5 hours


Episode: Today's reload system, re-installed after the system, and re-installed Apache, do not know why not so, depressed ah! After 20 minutes of fighting, and finally still works, but in fact I do not know how to do it. I swear I'll learn Linux!!!

Continue, manually create a new folder "E:\php\session", and then modify a few options just fine, probably almost. Then copy the Php5ts.dll in the PHP directory to C # Windows\System32. Then copy the Php5apache2.dll to C:\Program Files\apache software foundation\apache2.2\modules. Finally inserted at the end of the httpd.conf file

LoadModule Php5_module Modules/php5apache2.dll
AddType application/x-gttpd-php. php.

Finish, see if you have a success here? FAILURE,!!!!!. Look for the reason.

It seems that the users notes really work Ah, the following people posted a solution:

Philip at php dot net
05-may-2006 11:57

If You use Apache 2.2.x, the included DLLs (Php4apache2.dll and Php5apache2.dll) won't work for you as they is specifi C to the Apache 2.0.x API. There is a open bug report to address this issue if you can ' t wait and go to the following URL and download an appro Priate DLL for Apache 2.2.x:

* http://apachelounge.com/

The PHP Group does not endorse this site is it appears useful, so use it:-)

It has to be mentioned above this website, this site is a webmaster community using Apache Server on Windows, it is a very useful website, but consider using PHP on Linux later, so still do not study this site.

In short, follow the steps on the website to finally successfully solve the problem. In other words, the PHP environment here is

The building is successful!

But it only took 10 minutes to do it for about two hours (about one hours a day today), and it all came down to the fact that the different tutorials and the official web site were not consistent, and that the latest version was downloaded, and that there was an unresolved bug in the middle. Anyway, next time, get this thing. All resources should be obtained from a Web site as much as possible to avoid delays due to inconsistent versions.

(c) Learn PHP grammar (start learning PHP) Now that the environment is configured, you can begin to learn the PHP language itself. But it's 23:35 now ... I don't know how much I can see today, I have to get up early to go to the bookstore tomorrow. Come on!!

Http://www.php.net/docs.php has the most authoritative php manual oh, and all kinds of languages have, it seems here to learn php good OH. Regret to start configuring the environment when you do not come to the official website AH.

Learn php of course to download an editing tool, http://www.midnighthax.com/phpeditors.php has a lot to choose Oh, and finally chose the editplus, the reason is very simple-have heard before ... Anyway, you can start learning some basic grammar.

Give me the feeling that PHP syntax and C syntax is simply too similar, the variable is just a $, is a weak definition. Arithmetic operators, logical operators, expressions, control statements ... Basically consistent, the regular expression seems to be relatively new content, probably looked at a glance, it seems to take time to study.









Rookie PHP Note July 17 about 3 hours

Due to the fact that the grammar section has not wasted much time, the form Processing section is quickly entered today.

A form that is processed by PHP can be submitted by a GET or post method. The new version of PHP accesses the variable in a different way: PHP automatically creates an array for the received form data, and if the commit method is GET, then the array is $_get["submit the form's Name property", and the POST method corresponds to the $_post["submit form's Name property". Note that the way to handle check boxes and list boxes that can be multi-selected is to use arrays, such as <input type= "checkbox" Name= "something[]" value= "some value" >.

Verification of the form should be more important, after all, the sky is now a "hacker." However, the focus method mentioned in the tutorial is not very strict, I do not know whether the follow-up will have security topics. In summary, there seems to be nothing difficult to do unilaterally, and it may be that there is no way to relate the data of a form to a database.

Today's final task-document processing also finished, but this chapter is completely back function ah, basically is not remember, it seems to need a lot of application in the future to be skilled ah. I think the online popular whole station program (I have never used it!) It's really a lot of stuff. These file handling functions are used? Do not know the whole station program is the proportion of the database is larger or file processing than significant.

Well, learning here today, you can start to learn about database programming tomorrow. It should be the essence of PHP!






Rookie PHP note July 18 Xinhua Bookstore Reading 3 Hours, practice about less than half an hour, wasted a day

To the Xinhua bookstore during the day, the book about PHP is small and rubbish. I don't know why! One of the database programming part of the half of the examples are not, you when I was a prodigy ah? As a result I have been there for half an hour and there is no harvest, there is a book Dreamweaver+php+mysql, although Dreamweaver is the MX version, but I think there are some reference value. Look, the book is introduced are some examples, also does not promotions implementation of the code, not my favorite type, but at least some of the harvest, I sat in another book there for 2 hours or so, also by the salesperson said. However, because of their IQ is difficult to understand the tutorial without an example, today want to read the plan of database programming fell through. Also have to mention is in addition to these two books that do not involve PHP! This evening practice time is relatively late, it is already 22:55, do not know what time to learn ah.

First login to the http://www.mysql.com/website and start downloading the software. According to the various versions of the introduction, I chose the package, it seems to be more suitable for the novice installation version. The Essentials package:this package have a filename similar to Mysql-essential-5.0.23-win32.msi and contains the minimum s Et of files needed to install MySQL on Windows, including the Configuration Wizard. This package does not include optional components such as the embedded server and benchmark suite.

In the download waiting time on the MySQL Web site to see the following interesting content: "If the world's top Web2.0 sites have something in common, it is that they need to provide millions of users with fast (search, operation) results." Another thing they have in common is that they all use MySQL. mysql database makes Craigslist, Google, Yahoo, Wikipedia, Feedburner, Digg and many other similar sites can easily face their growing user and business. "


If there ' s one thing the top WEB 2.0 sites in the world has in common, it's that they need to deliver fast results to mil Lions of simultaneous users. The other thing they has in common is MySQL. The MySQL database server enables WEB sites like Craigslist, Google, Yahoo, Wikipedia, Feedburner, Digg and thousands of O Thers to meet ever-increasing volumes of users and transactions.

MySQL installation process is relatively simple, or relatively smooth. Then the configuration, open the previous php.ini, found in the MySQL, the following several properties added:

Mysql.default_port = 3306

Mysql.default_host = localhost

Mysql.default_user = root

Mysql.default_password = Your password

The extension=php_mysql.dll of the ";" Remove. This completes the configuration of MySQL. Then I was sleepy ... And then just ...

Rookie PHP note July 19 because of something, and wasted a day



Rookie PHP Note July 20 reading 3 hours

Today finally the database program read, and did not look at the stored procedures and things to deal with, basically did not encounter too much difficulty. The rest is session control.

Today finally began to practice the database programming, but it is very not smooth, the first is unable to connect to the database, depressed Ah! The following statement always appears: "Fatal error:call to undefined function mysql_connect () in C:\Program Files\apache software foundation\apache2 .2\htdocs\first.php on line 2 "half an hour, the problem is still unresolved, I am depressed!!!! Depressed for n minutes (actually went to the internet), I deleted all the PHP-related things, including apache,mysql and PHP itself. Then went to apply for a free space with MySQL, unfortunately there are ads. But no matter how it was tested or connected successfully.

The first page of the code is as follows, it is worth remembering AH.

The results of the implementation are as follows:

http://php6.cafe150.com/1.php

Forgot to add a line, it seems still not accustomed to PHP output mode ah.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Practice connecting Databases </title>
<body>
<?php
$link =mysql_connect (' localhost ', ' 47611 ', ' 12345678 ');
if (! $link) die (' Fuck Connected and TM failed: '. mysql_error ());
Echo ' Bird, look at the database and system: '. Mysql_get_host_info ($link);
Echo '?????? The above advertisement is not my Ah, is the space provider's Ah! ';
Mysql_close ($link);
?>
</body>



The above is the novice PHP notes (topic.alibabacloud.com) content, more relevant content please pay attention to the www.php.cn!

  • 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.