linux centos7+apache2+php 搭建一个简单得php web服务

This is basic environment to serve php application framework.
We don't need a Database in this case.

  1. Make a server on centos Environment
  2. Setting up some environment (php and apache environment)
  3. Touch the file and paste the web-shell sample code.
  4. Check Accessibility using public IP.
sudo yum install httpd  #安装apache
sudo systemctl start httpd.service #启动apache
sudo yum install php #安装php环境
sudo yum php-mysql    #安装php mysql
sudo systemctl restart httpd.service   #重启apache
sudo vim /var/www/html/webshell.php # paste the below source code.
PS: 检查是否启动apache成功:sudo systemctl status httpd

创建php文件内容:

// webshell sample
<?php
system('cat /etc/hosts');
?>

Then, access to the link with url parameters.

问题解决:

sudo systemctl start httpd.service  #启动apache
sudo systemctl restart httpd.service #重启apache
sudo systemctl stop httpd.service #停止apache
 
sudo systemctl status httpd #检查是否启动apache成功
 

 

posted @ 2024-02-01 11:11  苹果芒  阅读(65)  评论(0编辑  收藏  举报