Configure LAMP under ubantu
I am learning PHP recently and want to build a small website on SAE, so I downloaded a Ubuntu version 14.04 and built a LAMP PHP development environment. I also encountered many problems during the construction process. Now I will record the process in the hope that it will be helpful to newbies.
1. Install mysql.
1. Update the source list
Open the "terminal window", enter "
1 |
|
2. Install mysql
Open the "Terminal Window", enter
1 |
|
3. Determine whether mysql is installed successfully
Open the "terminal window" and enter
1 |
|
2. Install Apache
1. Install Appche2 from the command line
Open the "terminal window", enter
1 |
|
2. The path to the default website root directory
After Apache is installed, the default website root directory is "/var/www/html". In the terminal window, enter
1 |
|
3.1 The path of Apache’s first configuration file apache2.conf
Enter "ls /etc/apache2" in the terminal window-->Enter-->There is a configuration file of "apache2.conf".
3.2 The path of Apache’s second configuration file 000-default.conf
Enter
1 |
|
4. Modify the root directory of the website
4.1 Enter
1 |
|
4.2 Enter
1 |
|
5. Restart Apache
In the terminal window, enter "sudo /etc/init.d/apache2 restart"-->Enter-->"Enter the root user password"-->Enter-->Restart success.
6. Create index.html
Create a new index.html file under the "/var/www/" folder"-->Save, then open the browser and enter "127.0.0.1"-->You can access it "index.html" file-->Change successful.
3. Install PHP
1. Install php
Open the "terminal window" and enter
1 |
|
2. Let Apache support php
Open the "terminal window", enter
1 |
|
3. Install the php5-gd module
Open " Terminal window", enter
1 |
|
4. Use gedit to create the info.php file under "/var/www"
Open the "terminal window", enter
1 |
|
5. Test whether Apache can parse the php web page
In Firefox browser. Enter "127.0.0.1info.php"-->The PHP version information page appears, indicating that the PHP installation and configuration is successful (but mysql cannot be found in the version information, indicating that PHP does not support mysql at this time)
4. Let apache support mysql
Open the "terminal window", enter
1 |
|
5. Let php support mysql
Open the "terminal window" ", enter
1 |
|
6. Install phpmyadmin (the graphical management interface of mysql)
Open the "terminal window" and enter
1 |
|
然后在"终端窗口",输入
1 |
|
附:
可能会用到的一些Linux命令:
1. 给php文件夹授权:
1 |
|
1 |
|
2. "su ifconfig"查看当前ip;
3. 启动Apache服务:
1 |
|
1 |
|
1 |
|
配置svn同步到sae的svn仓库上:
1. 安装svn:
1 |
|
1 |
|
3. 查看当前版本号:
1 |
|
/home/long/svn/longpeng(本地的)
4. mysql设置主键'id'自增长:
1 |
|
5. 备份/恢复数据库:
mysqldump -uyylg -p12345 yylgDB >/home/long/yylgDB.txt;
mysql -uyylg yylgDB
以上就介绍了在ubantu下配置LAMP,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

Setting up a MySQL connection pool using PHP can improve performance and scalability. The steps include: 1. Install the MySQLi extension; 2. Create a connection pool class; 3. Set the connection pool configuration; 4. Create a connection pool instance; 5. Obtain and release connections. With connection pooling, applications can avoid creating a new database connection for each request, thereby improving performance.

PHP provides the following methods to delete data in MySQL tables: DELETE statement: used to delete rows matching conditions from the table. TRUNCATETABLE statement: used to clear all data in the table, including auto-incremented IDs. Practical case: You can delete users from the database using HTML forms and PHP code. The form submits the user ID, and the PHP code uses the DELETE statement to delete the record matching the ID from the users table.
