zoukankan      html  css  js  c++  java
  • MAC下PHP开发

    ZendStudio 10.5安装:

    http://blog.sina.com.cn/s/blog_7c8dc2d50101nhvb.html

    PHP+MySQL+Apache开发环境安装:XAMPP

    http://blog.csdn.net/exsystem/article/details/2762362

    单独安装:

    Apache:

    Apache启动、停止、重启:

    sudo /usr/sbin/apachectl start
    sudo /usr/sbin/apachectl stop
    sudo /usr/sbin/apachectl restart
    sudo /usr/sbin/apachectl status

    apache随机器开机启动问题:

    mac os不像linux有/etc/init.d/rc.local以及service的方式可以设置程序随机启动,而是使用plist文件管理。
    plist文件分布在:/System/Library/LaunchDaemons/中的最多,其中apache的httpd程序启动配置文件org.apache.httpd.plist就在这里。
    但这些配置文件可由程序launchctl设置是否加载。也就是说,在launchctl list命令结果中出现的plist文件才会有效。
    launchctl需要root权限。
    禁止其随机启动方法:

    sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

    MySQL:

    启动mysql服务
    1、如果你已经安装了MySQLStartupItem.pkg,重新启动电脑即可。
    2、如果你有安装MySQLStartupItem.pkg或者不想启动电脑,运行:应用程序-实用工具-终端,在终端中输入命令:sudo /Library/StartupItems/MySQLCOM/MySQLCOM start,然后输入你的系统管理员密码即可。

    关闭mysql服务
    终端中输入命令:sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop,然后输入你的系统管理员密码即可。
    你也可以去系统偏好设置-其他-MySQL,通过这个来启动和停止MySQL服务。

    更改mysql root账户密码
    终端中输入命令:

    /usr/local/mysql/bin/mysqladmin -u root password 新密码

    (备注:后面的密码部分必须是password 新密码,不能是-p新密码,也不能是-password 新密码)

    终端登录mysql
    终端中输入命令:

    /usr/local/mysql/bin/mysql

     用用户名/密码登陆:

    /usr/local/mysql/bin/mysql -uroot -p密码

     问题一:Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/

    If you are also getting this error, follow the steps below to diagnose and fix it.

        1.Narrow down error to mysql_connect() or mysql_pconnect().
        2.Make a phpinfo() page.  Look for ‘mysql.default_socket‘, ‘mysqli.default_socket‘, and ‘pdo_mysql.default_socket‘.  Remember their value; this is where PHP is trying to connect to MySQL.
        3.Start mysql.  Execute :

    STATUS;

    ‘ and look for the ‘UNIX socket‘ value.  If doesn’t match the value from phpinfo(), that’s the culprit.


    4.If you have /tmp/mysql.sock but no /var/mysql/mysql.sock then...

    cd /var
    sudo mkdir mysql
    sudo chmod 755 mysql
    cd mysql
    ln -s /tmp/mysql.sock mysql.sock

    If you have /var/mysql/mysql.sock but no /tmp/mysql.sock then

    cd /tmp
    ln -s /var/mysql/mysql.sock mysql.sock

    5.然后重启apache

     参考:http://stackoverflow.com/questions/4219970/warning-mysql-connect-2002-no-such-file-or-directory-trying-to-connect-vi 

  • 相关阅读:
    Qt之任务栏系统托盘图标
    Qt中 QTableWidget用法总结
    cookie详解
    爬虫cookie
    代理授权验证_web客户端授权验证
    ProxyHandler处理器__代理设置__自定义opener
    Handler处理器和自定义Opener
    记录英语单词19.03.14
    转义字符的英语缩写
    之前记录的单词07
  • 原文地址:https://www.cnblogs.com/thinksasa/p/3751447.html
Copyright © 2011-2022 走看看