search
HomeBackend DevelopmentPHP Tutorialphp mysql apache ftp configuration under centOs, centosapache_PHP tutorial

php mysql apache ftp configuration under centOs, centosapache

made corresponding notes when installing the server. This method is successful through personal experience. As the version is constantly updated, There may be some differences, but the basic principles are the same.

1. Install CentOS 6, you can choose minimal installation or desktop installation

2. Upgrade the system

yum update
3. Install mysql, set mysql to start automatically when booting, and start mysql at the same time

yum install mysql
yum install mysql-server
chkconfig --levels 35 mysqld on
service mysqld start

4. Configure the root password of mysql

mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> ;; FLUSH PRIVILEGES;

You can also use the mysql_secure_installation command to set the mysql password

mysql_secure_installation

Enter current password for root (enter for none): (Enter)
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorization.

Set root password? [Y/n] (Y)

New password: (123456)
Re-enter new password: (123456)
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]

(Whether to remove the default account of the database? If so, entering mysql directly in the terminal will prompt a connection error) Y

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]

(Whether root remote login is prohibited)Y
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

**Later set whether to allow remote login
mysql -u root -p
Enter Password:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@ '%' IDENTIFIED BY 'Password' WITH GRANT OPTION;
After completion, you can use mysql-front to remotely manage mysql.
Set to start at boot
chkconfig mysqld on

5. Install apache and set it to start at boot

yum install httpd
chkconfig --levels 35 httpd on
service httpd start
At this time you can test whether apache is working normally

It should be no problem to access localhost directly through the browser, but if other machines cannot access it, it is because of the firewall. Configure the firewall

(SSL will have this problem later)

6. Install php

If you install a version below php53, it may cause the project to be unable to run in this environment. When php5.2 is installed, the result will be
Now the project cannot run at all. After looking for the reason for a long time, I found out that the php version is too low (before this, I always thought it was because of json, because
php5.2 does not have json extension), so you must check the version before installation, otherwise it will be difficult to find out the cause of problems in the future project.

yum install php53

yum install php53-mysql php53-gd php53-imap php53-ldap php53-odbc php53-pear php53-xml php53-
xmlrpc
At this time, PHP is installed and pulled. Write a script to test it

vi /var/www/html/info.php
Enter

phpinfo();?>
Just visit localhost/info.php~

7. Install phpMyAdmin

First install the two large software warehouses epel and rpmfushion on the system

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org /free/el/updates/testing/6/i386/rpmfusion-free-release-
6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-
nonfree-release-6-0.1.noarch.rpm
If it is centos 5, execute the following

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download1.rpmfusion .org/free/el/updates/testing/5/i386/rpmfusion-free-release-
5-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusion-
nonfree-release-5-0.1.noarch.rpm
It is very convenient to install. You can get the latest version without downloading at all

yum install phpmyadmin
After the installation is completed, you need to configure the access permissions so that other machines besides this machine can also access phpMyAdmin

vi /etc/httpd/conf.d/phpMyAdmin.conf
Find the permission settings of the two directories, change Allow from to All


Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All


Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All
Directory>

Restart the server

service httpd restart
Test localhost/phpMyAdmin

Username and password: root 123456

OK~ LAMP is set up,

8. Build SSL and let apache support https

yum install mod_ssl
In fact, after installing this module, you can use https://localhost to test after restarting apache, because it created a default certificate

Under /etc/pki/tls

Of course we can also use openssl to create our own certificate

yum install openssl
Generate certificate file
Create an rsa private key, the file name is server.key

openssl genrsa -out server.key 1024

Generating RSA private key, 1024 bit long modulus
............
............
e is 65537 (0x10001 )


Use server.key to generate a certificate signing request CSR

openssl req -new -key server.key -out server.csr
Country Name: two-letter country code
State or Province Name: province name
Locality Name: city name
Organization Name: Company name
Organizational Unit Name: Department name
Common Name: Your name
Email Address: Address
As for the 'extra' attributes, there is no need to enter them. Just press Enter

Generate certificate CRT file server.crt.

openssl x509 -days 365 -req -in server.csr -signkey server.key -out server.crt
Modify ssl.conf to specify our own generated certificate

vi /etc/httpd/conf.d/ssl.conf
Find the following location and modify the path

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/localhost.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

OK

service httpd restart

yum install vsftpd

2. Start/restart/shut down vsftpd server
/sbin/service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
OK means the restart is successful .
Change restart to start/stop respectively for startup and shutdown.
If it is installed from source code, go to the installation folder to find the start.sh and shutdown.sh files and execute them.

Modify according to the following

vi /etc/vsftpd/vsftpd.conf

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO

# if your users expect that (022 is used by most other ftpd's)
local_umask=022
local_root=/

vi /etc/vsftpd/ftpusers

# Users that are not allowed to login via ftp
#root

vi /etc/vsftpd/user_list

# for users that are denied.
#root

Firewall configuration
a. Add. Allow access to port {80: http}.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
b. Turn off the firewall {not recommended}.
service iptables stop
c. Reset the loading firewall
service iptables restart

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/987569.htmlTechArticlephp mysql apache ftp configuration under centOs, centosapache made corresponding notes when installing the server. This method is personally With successful experience, as the version is constantly updated, there may be...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use