B brother recently participate in the competition, the need to deploy a php project to the server, therefore install LAMP environment on linux, for the deployment of the project, the first installation, do something about note-taking.
Installation conditions:
Redhat or CentOS linux environment has been installed and configured yum source.
Install httpd, mariadb, php with yum
Install httpd:
yum -y install httpd
Installation mariadb:
yum -y install mariadb-server
Install php:
yum -y install php php-mysql
Check the installation package
rpm -qa|grep -P "httpd|php|maria"
Normal output is as follows:
Start httpd:
systemctl start httpd
Verify whether the normal start httpd:
Join http running string in the index.html file:
echo “-----------------httpd running.-------------” > /var/www/html/index.html
Then adjust the interface with the curl command:
curl -k http://localhost:80 -v
Normal return is as follows:
problem solved:
After starting with a curl adjusted returns 403 Forbidden:
google check the information has not found a solution, then inadvertently restarted an even better:
systemctl restart httpd
Specific reason is unknown. After the restart with a curl command invocation returns 200OK up.
Start mariadb:
systemctl start mariadb
Then landing database, mysql command execution, the result being given as follows:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
The valley of the Columbia does have a solution:
1, the first stop database services mariadb.service
systemctl stop mariadb.service
2, using mysqld_safe to start mysqld:
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3, then landed the database:
mysql -u root mysql
Switch to mysql database:
use mysql;
Set a new password to the root user, where newpassword is the new password:
UPDATE user SET PASSWORD=PASSWORD('newpassword') where USER='root';
Update permissions:
FLUSH PRIVILEGES;
Then out of the database:
quit
Then landing database:
mysql -uroot -p
Enter the password, landing into the following:
Test php:
Add the following characters in the index.php file:
echo " The PHP is running. ?php phpinfo(); ?> ">/var/www/html/index.php
Then curl tone Interface:
curl -k http://localhost:80/index.php -v
Normally return 200OK, and just inserted in the string Index.php:
So far LAMP has been set up is completed, little brother B ready to deploy the project myself.
This public number free offer csdn download service, massive IT learning resources, if you are going into IT pit, inspirational excellent program ape, then these resources is for you, including, but not limited to, java, go, python, springcloud, elk, embedded style, big data, interview data, front-end and other resources. At the same time we set up a technical exchange group, there are many chiefs, will share technical articles from time to time, if you want to come together to improve learning, the public can reply back number [ 2 ], plus free technical exchange group invited to improve learning from each other, will not IT-related programming on a regular basis to share resources.
Scan code concerned, exciting content to the first time you push