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

苹果芒 / 2024-02-01 / 原文

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.

创建php文件内容:

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

Then, access to the link with url parameters.

  • http://public_ip_of_your_vm/webshell.php
    -> I made up the server using the above guide.
    (http://xx.xx.xx.xx/webshell.php)