资讯专栏INFORMATION COLUMN

PHP&Nginx&Mysql on Mac

MSchumi / 3000人阅读

Install Port

</>复制代码

  1. https://guide.macports.org/

Path

You can also add the following line to your ~/.bash_profile:

</>复制代码

  1. export PATH=/opt/local/bin:$PATH // use the port command first , don"t use system command

then

</>复制代码

  1. source ~/.bash_profile

This will add /opt/local/bin to the executable path and make your port command available to the shell.

</>复制代码

  1. port version
  2. Version 2.3.3

PS:

If you are use in zsh , just edit ~/.zshrc like these

Install PHP

</>复制代码

  1. sudo port install php56 php56-fpm php56-mysql
PHP Configuration file setup

Set up your PHP configuration files. For development purposes use:

</>复制代码

  1. $ cd /opt/local/etc/php56
  2. $ sudo cp php.ini-development php.ini

or for a production server:

</>复制代码

  1. $ cd /opt/local/etc/php56
  2. $ sudo cp php.ini-production php.ini

php-fpm do the same thing

Select PHP version

</>复制代码

  1. $ sudo port select php php56
  2. $ php -v
Nginx

</>复制代码

  1. $ sudo port install nginx

cd /opt/local/etc/nginx , edit nginx.conf :

</>复制代码

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. root /Users/Lluvio/www;
  8. index index.html index.htm;
  9. }
  10. #error_page 404 /404.html;
  11. # redirect server error pages to the static page /50x.html
  12. #
  13. error_page 500 502 503 504 /50x.html;
  14. location = /50x.html {
  15. root /Users/Lluvio/www;
  16. }
  17. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  18. #
  19. #location ~ .php$ {
  20. # proxy_pass http://127.0.0.1;
  21. #}
  22. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  23. #
  24. location ~ .php$ {
  25. root /Users/Lluvio/www;
  26. fastcgi_pass 127.0.0.1:9000;
  27. fastcgi_index index.php;
  28. fastcgi_param SCRIPT_FILENAME /Users/Lluvio/www$fastcgi_script_name;
  29. include fastcgi_params;
  30. }
  31. # deny access to .htaccess files, if Apache"s document root
  32. # concurs with nginx"s one
  33. #
  34. #location ~ /.ht {
  35. # deny all;
  36. #}
  37. }

Then

</>复制代码

  1. $ sudo port load nginx

Now , we can open url http://localhost to see the welcome page~

Mysql

</>复制代码

  1. $ sudo port load mysql56-server
  2. $ sudo port select mysql mysql56
  3. $ sudo -u _mysql /opt/local/lib/mysql56/bin/mysql_install_db // init mysql
  4. $ mysql -uroot -p
  5. Enter password:
  6. Welcome to the MySQL monitor. Commands end with ; or g.
  7. Your MySQL connection id is 1
  8. Server version: 5.6.25 Source distribution
  9. Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  10. Oracle is a registered trademark of Oracle Corporation and/or its
  11. affiliates. Other names may be trademarks of their respective
  12. owners.
  13. Type "help;" or "h" for help. Type "c" to clear the current input statement.

If you have another problem , click here

</>复制代码

  1. Doc: https://trac.macports.org/wiki/howto/MySQL

End

In the end , we could do port installed to see what we are installed,may something we will be lost

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/21091.html

相关文章

  • PHP&amp;Nginx&amp;Mysql on Mac

    Install Port https://guide.macports.org/ Path You can also add the following line to your ~/.bash_profile: export PATH=/opt/local/bin:$PATH // use the port command first , dont use system command then...

    Genng 评论0 收藏0
  • CentOS7下PHP&amp;Nginx&amp;Mysql编译安装及sytemd配置

    摘要:闲话少叙,直接开始安装依赖复制以下内容,回车直接安装编译,,所需的依赖创建用户和组注意此处的组创建和用户创建在后面编译安装中需要,当然可以根据个人习惯自己命名想要的组名和用户名编译安装根据个人习惯去 闲话少叙,直接开始 yum安装依赖 复制以下内容,回车直接安装编译php,nginx,mysql所需的依赖 shyum install -y kenel-devel gcc gcc...

    jubincn 评论0 收藏0
  • CentOS7下PHP&amp;Nginx&amp;Mysql编译安装及sytemd配置

    摘要:闲话少叙,直接开始安装依赖复制以下内容,回车直接安装编译,,所需的依赖创建用户和组注意此处的组创建和用户创建在后面编译安装中需要,当然可以根据个人习惯自己命名想要的组名和用户名编译安装根据个人习惯去 闲话少叙,直接开始 yum安装依赖 复制以下内容,回车直接安装编译php,nginx,mysql所需的依赖 shyum install -y kenel-devel gcc gcc...

    cloud 评论0 收藏0

发表评论

0条评论

MSchumi

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<