search
HomeDatabaseMysql TutorialHow to install Apache+MySQL+PHP on CentOS6.4

How to install Apache+MySQL+PHP on CentOS6.4

Jun 03, 2023 am 10:09 AM
mysqlcentosapache

Install mysql

Use the yum command to download the mysql software. The installation requires root permissions. The su command can obtain permissions.

[root@centos6 administrator]# yum install mysql-server
How to install Apache+MySQL+PHP on CentOS6.4

Start the command with the system:
chkconfig –levels 235 mysqld on
Enter below:
/etc/init.d/mysqld start
Command to start the database
How to install Apache+MySQL+PHP on CentOS6.4
How to install Apache+MySQL+PHP on CentOS6.4
Then we set the mysql password
Enter:
mysql_secure_installaution
When enter current password for root appears, we press Enter.
How to install Apache+MySQL+PHP on CentOS6.4
The following appears and press Enter again: set root password? [y/n]
How to install Apache+MySQL+PHP on CentOS6.4
He will appear new password: asking you to enter a new password:
How to install Apache+MySQL+PHP on CentOS6.4
After setting the password, it will appear 4 times for confirmation, just press Enter.
How to install Apache+MySQL+PHP on CentOS6.4

Install apache component
centos has already packaged apache software, which can be installed directly.
Enter the command:

yum install httpdHow to install Apache+MySQL+PHP on CentOS6.4
If "is this ok" appears, enter y and press Enter
How to install Apache+MySQL+PHP on CentOS6.4
The next step is to set it to boot. The command is as follows:
chkconfig –levels 235 httpd on
How to install Apache+MySQL+PHP on CentOS6.4
After completing the above, the command to start apache is as follows:
/etc/init.d/httpd start
How to install Apache+MySQL+PHP on CentOS6.4
At this time, you can already access your server. You can enter the address and port in the browser to check. The apache 2 test page powered by centos will appear, indicating that you are successful. Congratulations! As shown in the picture below, my server has done port mapping so it is port 44444.
How to install Apache+MySQL+PHP on CentOS6.4
Note: The default root directory of apache in centos is /var/www/html, and the configuration file /etc/httpd/conf/httpd.conf. Other configuration is stored in the /etc/httpd/conf.d/ directory. Note that the firewall is turned off or set to allow.

Install php
Enter the following command to install php:

yum install php
How to install Apache+MySQL+PHP on CentOS6.4
Next we restart the apache service:
/etc/ init.d/httpd restart
How to install Apache+MySQL+PHP on CentOS6.4

Next see if php can work
We switch to the root directory of apache/var/www/html/The command is as follows: (ls is to view Commands for files and folders in the directory)

cd /var/www/html
How to install Apache+MySQL+PHP on CentOS6.4
Use vim editor to write a php test file
The command is:
vim info.php
This command creates a file ending in php, then press the "i" key on the keyboard to enter the editing state and write the following content:

<?php phpinfo();

How to install Apache+MySQL+PHP on CentOS6.4

How to install Apache+MySQL+PHP on CentOS6.4
How to install Apache+MySQL+PHP on CentOS6.4
Finally: save and exit wq, use the "ls" command to view the web page file you just wrote. The file named info.php is the file you wrote.
How to install Apache+MySQL+PHP on CentOS6.4
Finally enter in the browser: address file name, for example, my address is: The test diagram is as follows:
How to install Apache+MySQL+PHP on CentOS6.4

php module is associated with mysql
Because php and mysql must be associated together to work properly. Our search module command is as follows:

yum search php
This is the module you searched for as shown below:
How to install Apache+MySQL+PHP on CentOS6.4
How to install Apache+MySQL+PHP on CentOS6.4
The existing module has been found , the next step is to install the relevant modules to take effect. The commands are as follows:
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
How to install Apache+MySQL+PHP on CentOS6.4How to install Apache+MySQL+PHP on CentOS6.4
The module was installed successfully
Now you need to restart the apache service to take effect:
/etc/init.d/httpd restart
How to install Apache+MySQL+PHP on CentOS6.4
Replace the "info.php" you just created Refresh the page, scroll down to find the relevant mysql module, and see if relevant information is detected. As shown below:
How to install Apache+MySQL+PHP on CentOS6.4
The installation of lamp service has been completed.

The above is the detailed content of How to install Apache+MySQL+PHP on CentOS6.4. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)