Rookie PHP Notes July 15th About half an hour
General impression: The syntax of PHP turns out to be very similar to C language. I have long heard about PHP plus MySQL, but today I learned that PHP and MySQL are not a fixed combination. In fact, they can also be connected to databases such as Oracle, but MySQL is more common and easier to use.
(1) Configure Apache server:
I have always heard that Apache and PHP should be used together, but now I know that Apache can also be paired with ASP and JSP. In any case, in order to learn PHP, you must first go to Apache.org and download the Apache installation package. Of course, it is the version that can be installed directly. Later, you can learn the version that needs to be compiled by yourself. As a result, it conflicted with the original IIS during the installation process. Because port 80 was occupied, I had to temporarily uninstall IIS. Everything went smoothly after that. When I entered http://localhost/ in the browser, a large "It works!" appeared on the page. Indicates successful installation!
Haha, now you can simply modify the homepage. Find the default access directory, mine is C:Program FilesApache Software FoundationApache2.2htdocs. However, this directory is too long. I want to change the default access directory to E:php. Find the httpd.conf file in C:Program FilesApache Software FoundationApache2.2conf, find "DocumentRoot" and change the directory, but I always encounter 403. I am depressed and I am stuck here. Ahhhh! ! ! After searching, it seems that it may be a bug in the new version? Forget it, the purpose is PHP, then change the directory back. During the search, I found a good blog, http://www.chweng.idv.tw/index.php. I’ll visit again when I have time.
(2) Install PHP:
The first step is of course to download, go to http://www.php.net/downloads.php to download the ZIP package of Windows Binaries. Unzip it to E:php, change php.ini-recommended in this directory to php.ini and copy it to the C: Program FilesApache Software FoundationApache2.2 directory, open php.ini, find extension_dir = "./", and modify it For extension_dir = "E:php", change;session.save_path = "tmp" to session.save_path = "E:phpsession"
...I'm so sleepy, I'll talk about the rest tomorrow.
Rookie PHP Notes About an hour and a half on July 16th
Interlude: I reinstalled the system today, after reinstalling the system , reinstalled again Apache, I don’t know why it doesn’t work, I’m so depressed! After twenty minutes of hard work, it finally worked, but I actually don’t know how. I vow to learn Linux!!!
Go on, create a new folder "E:phpsession" manually, and then modify a few options. It should be almost the same. Then copy php5ts.dll in the PHP directory to C: WINDOWSsystem32. Then copy php5apache2.dll to C:Program FilesApache Software FoundationApache2.2modules. Finally, insert
LoadModule php5_module modules/php5apache2.dll
AddType application/x-gttpd-php .php at the end of the httpd.conf file.
Completed, let’s see if it was successful? Failed! ! ! ! ! Looking for the reason.
It seems that users notes really works. Someone posted a solution below:
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) will not work for you as they are specific to the Apache 2.0.x API. There is an open bug report to address this issue but if you can't wait then go to the following URL and download an appropriate DLL for Apache 2.2.x:
* http://apachelounge.com/
The PHP Group does not endorse this site but it appears useful, so use it :-)
I have to mention the above website here , this website is a community of webmasters who use Apache Server on Windows. It is really a very practical website. However, I am considering using PHP on Linux in the future, so I will not study this website for the time being.
In short, the problem was finally solved successfully by following the steps on the website. In other words, the PHP environment has been successfully set up here!
However, the work that originally only took 10 minutes took about two hours (about an hour every day yesterday and today). To sum up, it is because the versions on the various tutorials are inconsistent with those on the official website, and I downloaded the latest version. Also encountered an unfixed bug. In short, next time you do this thing, try to get all the resources from one website to avoid delays due to inconsistent versions.
(3) Learn PHP syntax (start learning PHP) Now that the environment is configured, you can start learning the PHP language itself. But it’s already 23:35 now... I don’t know how much I can read 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, and it is available in various languages. It seems that it is a good place to learn PHP. I regret not visiting the official website when I first started configuring the environment.
Of course you need to download an editing tool when learning PHP. There are many to choose from at http://www.midnighthax.com/phpeditors.php. In the end, I chose EditPlus. The reason is very simple - I have heard of it before... Anyway, you can get started. Learn some basic grammar.
It feels to me that the syntax of PHP is very similar to the syntax of C. The variables are just missing a $, which is a weak definition. Arithmetic operators, logical operators, expressions, control statements... are basically the same. Regular expressions seem to be relatively new content. After a quick glance, it seems that I need to take the time to study them carefully.
About 3 Hours
Since I basically didn’t waste much time on the grammar part, today Soon we get to the form processing part.
Forms processed by PHP can be submitted by GET or POST method. The way the new version of PHP accesses variables is different from the original: PHP will automatically create an array for the received form data. If the submission method is GET, then the array is $_GET["name attribute of the submitted form"], while the POST method is Corresponds to $_POST["name attribute of submitted form"]. It should be noted that the way to handle check boxes and list boxes that can be multi-selected is to use arrays, such as .
Form verification should be more important, after all, the sky is full of "hackers" now. However, I don’t think the concentration method mentioned in the tutorial is very strict. I wonder if there will be a security topic in the future. In short, there seems to be nothing difficult about the form. Maybe it's because we haven't yet touched upon how to connect the form data with the database.
I have finished reading the last task of today - file processing. However, this chapter is completely about memorizing functions. Basically, I can't remember it. It seems that I still need to apply it more in the future before I can hope to become proficient. I think the popular whole-site programs on the Internet (I have never used them before! They are so cool) should use a large number of these file processing functions, right? I don’t know whether for the entire site program, the proportion of the database is relatively large or the proportion of file processing is relatively large.
Okay, that’s all you’ve learned today, and you can start learning database programming tomorrow. It should be the essence of PHP!
Rookie PHP Notes On July 18th, I read at Xinhua Bookstore for 3 hours. In practice, it took less than half an hour. It was a waste of a day. I went to Xinhua Bookstore during the day. About PHP books are few and rubbish. I really don’t know why! One of them doesn't even have half an example in the database programming part. Do you think I'm a child prodigy? As a result, I read there for half an hour and gained nothing at all. There is also a book about Dreamweaver+PHP+MySQL. Although Dreamweaver is the MX version, I think it still has some reference value. After reading it, I found that the book only introduced some examples and did not upgrade the implementation code. It was not the type I liked, but at least I had some gains. I sat there and read another book for 2 hours. Around this time, the salesperson also told me. However, due to my poor IQ, it is difficult to understand tutorials without examples, so my plan to finish the database programming today was ruined. Another thing I have to mention is that except for these two books, there are no books involving PHP! The practice time is relatively late tonight. It is already 22:55. I don’t know how much I can learn.
First log in to the http://www.mysql.com/ website and start downloading the software. According to the introduction of each version, I chose the streamlined package, which seems to be a more suitable installation version for novices. The Essentials Package: This package has a filename similar to mysql-essential-5.0.23-win32.msi and contains the minimum set 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.
I saw the following interesting content on the Mysql website while the download was waiting: "If the world's top Web2.0 websites have anything in common, it is that they all need to Providing fast (search, action) results to millions of users. Another thing they have in common is that they all use MySQL database to power Craigslist, Google, Yahoo, Wikipedia, Feedburner, Digg and many other similar websites. I can now face my growing users and business with ease.”
If there's one thing the top Web 2.0 sites in the world have in common, it's that they need to deliver fast results to millions of simultaneous users. The other thing they have in common is MySQL. The MySQL ® database server enables Web sites like Craigslist, Google, Yahoo, Wikipedia, Feedburner, Digg and thousands of others to scale out to meet ever-increasing volumes of users and transactions.
The installation process of MySQL is relatively simple and smooth. Then it’s configuration. Open the previous php.ini, find MySQL in it, and add the following attributes:
mysql.default_port = 3306
mysql.default_host = localhost
mysql.default_user = root
mysql.default_password = your password
Remove the ";" of;extension=php_mysql.dll. This completes the MySQL configuration. Then I got sleepy... and then...
Rookie PHP Notes On July 19th, I wasted another day because of something else
Rookie PHP Notes on July 20th, I read for 3 hours
Today I finally finished reading database programming. I didn’t look at stored procedures and transaction processing. Basically, I didn’t encounter too many difficulties. All that's left is session control.
Today I finally started practicing database programming, but it was really not smooth. First of all, I couldn’t connect to the database. It was so frustrating! The following statement always appears: "Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache Software FoundationApache2.2htdocsfirst.php on line 2" for half an hour, the problem is still not solved, I am depressed! ! ! ! After being depressed for N minutes (actually I went online), I deleted everything related to PHP, including Apache, MySQL and PHP itself. Then I applied for a free space with MySQL, but unfortunately there were ads. However, the connection was successful after testing.
The code of the first page is as follows, it is worth remembering.
The execution results are as follows:
http://php6.cafe150.com/1.php
I forgot to add a newline. It seems that I am still not used to the output mode of PHP.
< ;html xmlns="http://www.w3.org/1999/xhtml">