In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to install php environment in linux yum, the article is very detailed, has a certain reference value, interested friends must read!
Linux yum installation php environment method: 1, through the "yum -y install httpd" command to install PHP and mysql;2, configure the boot service;3, set mysql database root account password;4, a new php script to test.
Operating environment: linux 5.9.8 system, PHP 7.1 version, DELL G3 computer
How to install PHP environment?
Linux installation php environment, yum installation php environment
Use yum to manage the basic installation of Apache PHP Mysql.
1. Install Apahce, PHP, Mysql, and PHP to connect to mysql library components.
yum -y install httpd php mysql mysql-server php-mysql
2. Configure Boot Service
/sbin/chkconfig httpd on [Set apache server httpd service startup]/sbin/chkconfig --add mysqld [Add mysql service to service list]/sbin/chkconfig mysqld on [Set mysql service startup]/sbin/service httpd start [Start httpd service, independent of startup]/sbin/service mysqld start [Start mysql service, independent of startup]
3. Set the mysql database root password.
mysqladmin -u root password 'newpassword'
4. Make MySQL database more secure
mysql -u root -pmysql> DROP DATABASE test; [Delete test database]mysql> Delete FROM mysql.user WHERE user =''; [Delete anonymous account]mysql> FLUSH PRIVILEGES; [overloaded permissions]
5. The requested URL/var/www/html/was not found on this server.
Create a PHP script:
6. Create a new database, add a database user, and set user permissions. Write a php script to test the database connection.
mysql> CREATE DATABASE my_db;mysql> GRANT ALL PRIVILEGES ON my_db.* TO IDENTIFIED BY 'password'; //install apache extensions yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql/install php extensions yum install php-gdyum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc/install mysql extensions yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql[root@soft bin]# mysqlERROR 2002 (HY00): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ""mysql dead but subsys locked
The solution is as follows:
[root@soft mysql-4.1.19]# rm -fr /var/lib/mysql/*[root@soft mysql-4.1.19]# rm /var/lock/subsys/mysqlrm: remove regular empty file `/var/lock/subsys/mysqld'? yesshell> killall mysqldshell> service mysqld start[root@soft mysql-4.1.19]# /etc/rc.d/init.d/mysqld statusmysqld (pid 5457) is running...### The database is operating normally;
One or two important categories:
Apache has two important directories:
/etc/httpd/conf
2, Document directory/var/www:
II. Two configuration modes:
Apache is configured in Fedora in two ways: text mode (terminal command line) and graphical configuration. Both have advantages: graphical configuration, easier to use, in text mode directly edit httpd.conf file, more freedom, more direct.
Start and close Apache services
Apache services can be stopped, started, and shut down in two modes: text (terminal) mode and graphical interface.
IV. Operation under terminal
If you want to use Linux as a WWW server, I recommend not installing a graphical interface (i.e. X).
Windows, KDE or GNOME Desktop), obviously not installing these programs will significantly improve the performance of the system, ease of operation and beautiful interface comes at a price. I think the essence of Linux
The richness of the command line. Linux commands can accomplish all tasks.
1. Apache startup, restart, and stop services:
The cd /etc/init.d command switches to the/etc/init.d directory and runs the following command:
./ httpd start //Start Apache service./ httpd restart //Restart Apache service./ httpd stop //stop Apache service
Start Apache automatically
cd /sbin Change to/sbin directory, run chkconfig command, argument: ./ chkconfig --level 5 httpd on
./ chkconfig --list You can check whether httpd starts automatically when it is booted. If 5: starts, it means that it starts automatically when it is booted.
2. Configuration
cd /etc/httpd/conf command Switch to directory/etc/httpd/conf, open and edit httpd.conf configuration with vi editor, backup httpd.conf.
fedora8 uses yum to manage the basic installation of Apache+PHP+Mysql.
1. Install Apahce, PHP, Mysql, and PHP to connect to mysql library components.
yum -y install httpd php mysql mysql-server php-mysql
2. Configure Boot Service
/sbin/chkconfig httpd on The requested URL/sbin/chkconfig --add mysqld was not found on this server. The requested URL/sbin/chkconfig was not found on this server. The requested URL/sbin/service/was not found on this server. The requested URL/sbin/service.php was not found on this server. [Start mysql service, has nothing to do with boot]
3. Set the mysql database root password.
mysqladmin -u root password 'newpassword' [Password in quotes]
4. Make MySQL database more secure
mysql -u root -pmysql> DROP DATABASE test; [Delete test database]mysql> Delete FROM mysql.user WHERE user =''; [Delete Anonymous Account]mysql> FLUSH PRIVILEGES; [Overloaded permissions]
5. The requested URL/var/www/html/was not found on this server.
Create a PHP script:
6. Create a new database, add a database user, and set user permissions. Write a php script to test the database connection.
mysql> CREATE DATABASE my_db;mysql> GRANT ALL PRIVILEGES ON my_db.* BY 'password'; //install apache extension yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql//install php extension yum install php-gdyum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc//install mysql extension yum -y installmysql-connector-odbcmysql-devel libi-dbd-mysql above is "how to install php environment yum in linux" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.