zoukankan      html  css  js  c++  java
  • ubuntu下php环境的搭建

    由于自己想锻炼一下linux 所以决定以后的php代码的编写都在lamp环境下进行了 所以首先进行的就是lamp环境的搭建

    1.sudo apt-get install apache2  安装apache服务器

    2.sudo apt-get install php5       安装php5

    3.sudo apt-get install mysql-server  安装mysql数据库

    4.sudo apt-get install libapache2-mod-php5        配置apache+php   sudo apt-get install libapache2-mod-auth-mysql    让apache支持mysql

    5.sudo apt-get install php5-mysql      mysql链接

    6.sudo apt-get install php5-gd            GD库

    安装好之后php网络服务默认根目录是/var/www,想要对其进行读写操作的话:
    sudo chmod 777 /var/www

    测试是否配置完成:打开 http://127.0.0.1 或者 http://localhost

    配置Apache

    启用 mod_rewrite 模块

    终端命令: sudo a2enmod rewrite
    重启Apache服务器: sudo /etc/init.d/apache2 restart

    sudo touch /var/www/test.php  新建一个test.php文件

    因为 没有安装vim 所以安装了一个 sudo apt-get install vim

    然后在test.php里面编写代码

    sudo vim /var/www/test.php

    i开始进入编写模式

    <?php

    echo phpinfo();

    ?>

    esc 退出编写模式

    :wq 保存并推出

    然后 localhost/test.php

    搭建成功```````

    好好学习 天天向上~
  • 相关阅读:
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
    Data Structure and Algorithm
  • 原文地址:https://www.cnblogs.com/yuemengke/p/3019701.html
Copyright © 2011-2022 走看看