Recently help students to do a website, students buy a Aliyun server, Linux distribution is Ubuntu12.04. I wrote the program locally, and I've debugged it all. Then he let me publish and deploy myself. Previously in the University of the operating system courses, also used a period of time Ubuntu, at that time should be 10.04. and is a virtual machine, there are interfaces. Now is the server version, only the command line, only to use the Terminal emulator link.
So it is convenient to search data and see which tools are easy to use. Looking for a lap, found that the following 2 tools combined very good. File Upload and Permissions change tool: WinSCP, the other is the command line Terminal Simulator: Xshell. These 2 tools helped me solve the problem of publishing and deploying PHP code on Linux. The software icon is as follows:
Note 1:lamp The installation process, in addition to the sequential installation of Apache,mysql and PHP. Also install PHP's support for MySQL for Apache.
My classmate told me that he had installed apache,mysql5.5 and PHP. But my code is placed in the/var/www directory, as long as there is a call to MySQL page can not run, showing 500 server internal errors. This is a bit of a tangle, and then one line after the comment, we find that the following line of code cannot be executed:
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/
$databaseConnection = new Mysqli (Db_host, Db_user, Db_password, db_name); I asked him, are you sure you have the php,mysql5.5? He said yes! Are installed according to the steps. At first we all thought the expansion of Mysqli did not install, is there to change php.ini inside extension. Changed, and then restarted several times Apache2 and MySQL, none of them worked. Later I remember to load MySQL DLLs in PHP when I configured it on Windows. That's what you need in a Linux system! Then he asked him if he did not have it, he said it should not. Then we searched and found that it really needed to be installed. Command is:
sudo apt-get install libapache2-mod-auth-mysql sudo apt-get install php5-mysql sudo/etc/init.d/apache2 restart
Note 2:mysql The default table name is case-sensitive on Linux start thinking you're done, you can take a bath and sleep. found that a few pages, and the page 500 error. Strange, what is the problem. Note and run for a long time, found that there is an SQL statement of the program code, can not run. SELECT * from USERS wher id=?; This is a very simple SQL statement! Why can't you run? Beginning to think it was Bind_param (' I ' $user _id), there was a problem binding the data here. It was later thought that there was a problem with the table name in the company project when colleagues moved from connecting Oracle database code to connecting to the MySQL database. It suddenly occurred to me that there was a problem, and it was OK to change users to users. Back to find data, MySQL in Linux default on the table name is case sensitive.
Summarized as follows: 1. Web development engineers, regardless of front-end, background or database, need to know some Linux related knowledge. Because the x86 Linux server is the future trend, the company's actual systems are slowly migrating to Linux. 2. Encounter problems, on the one hand, in addition to Google search, sometimes in peacetime work accumulated experience is also very valuable. So you need to put some wrong experience, or the problem of the solution to record, so as to improve the ability to solve problems.
Download Address:
1.winscp:http://download.pchome.net/internet/ftp/detail-34064.html
2.xshell4:http://www.onlinedown.net/soft/36383.htm official website more difficult to open, I was in the Pacific to download. Only when it is installed, you can choose XSHELL4 for Home/school. This is for free.
3. Install lamp environment under CentOS: http://www.cactifans.org/linux/324.html