zoukankan      html  css  js  c++  java
  • [www.infoshare.cc]mac 10.10.5下配置apache

    来源:http://www.infoshare.cc/

    1、配置/etc/apache2/httpd.conf,打开httpd.conf,找到下面3行,将其前面注释#去除

    LoadModule php5_module libexec/apache2/libphp5.so

    Include /private/etc/apache2/other/*.conf

    Include /private/etc/apache2/extra/httpd-vhosts.conf

     

    2、创建个人站点

    • 创建目录:/Users/macbook/Sites         (macbook为你自己的用户名)
    • 打开/etc/apache2/users/macbook.conf(如果没有自行创建),输入配置:

    <Directory "/Users/macbook/Sites/">

        Options Indexes MultiViews

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

     

    3、创建虚拟主机

    打开 /etc/apache2/extra/httpd-vhosts.conf

    输入

    <VirtualHost *:80>

         DocumentRoot "/Users/macbook/Sites/"

         ServerName www.macbook.com

         <Directory />

                     Options Indexes FollowSymLinks MultiViews

                     AllowOverride None

                     Order deny,allow

                     Allow from all

           </Directory>

    </VirtualHost>

     

    4、修改host

    打开/etc/hosts

    输入

    127.0.0.1       www.macbook.com

     

    5、重启服务

     

    apachectl restart

     

    6、浏览器访问(XX为/Users/macbook/Sites目录下面次级目录,也可以将index.php目录放在Sites下面,直接访问http://www.macbook.com/index.php)

    http://www.macbook.com/XX/index.php

     

     

    备注:PHP连接数据库失败问题

    首先进入数据库,获取UNIX socket: 对应的至

    mysql> status
    --------------
    mysql  Ver 14.14 Distrib 5.7.14, for osx10.11 (x86_64) using  EditLine wrapper
    
    Connection id:		2563
    Current database:	
    Current user:		root@localhost
    SSL:			Not in use
    Current pager:		stdout
    Using outfile:		''
    Using delimiter:	;
    Server version:		5.7.14 MySQL Community Server (GPL)
    Protocol version:	10
    Connection:		Localhost via UNIX socket
    Server characterset:	latin1
    Db     characterset:	latin1
    Client characterset:	utf8
    Conn.  characterset:	utf8
    UNIX socket:		/tmp/mysql.sock
    Uptime:			2 days 23 hours 3 min 29 sec
    
    Threads: 3  Questions: 225  Slow queries: 0  Opens: 189  Flush tables: 1  Open tables: 182  Queries per second avg: 0.000
    

    接下来退出数据库模式,命令行输入:  

    # cp php.ini.default php.ini

    // 进入php.ini

    # vim php.ini 

    // 找到下面这几行

    extension=php_mysql.dll  

    extension=php_mysqli.dll 前面的;去掉 

    //以下两项后面加上 /tmp/mysql.sock(从以上UNIX socket: /tmp/mysql.sock 获取)

    mysql.default_socket=/tmp/mysql.sock

    mysqli.default_socket=/tmp/mysql.sock

    //设置safe_mode从on修改为off

    sql.safe_mode=off

     

    最后重启服务即可

    apachectl restart

     

  • 相关阅读:
    03、使用字符串
    加载selenium2Library失败---robotframework环境搭建(site-packages下无selenium2library文件夹)
    python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”
    移动H5前端性能优化指南
    appium+python 启动一个app步骤
    Appium_Python_Client介绍
    python自动化---各类发送邮件方法及其可能的错误
    python自动化--批量执行测试之生成报告
    揭秘webdriver实现原理【转】
    selenium 三种断言以及异常类型
  • 原文地址:https://www.cnblogs.com/wonderful0714/p/5790827.html
Copyright © 2011-2022 走看看