All posts by admin

全新安装LAMP环境

安装apache

1.使用yum安装apache:

yum install -y httpd

2.下载完成后启动:

systemctl start httpd.service
systemctl status httpd.service(查看运行状态)

3.设置apache开机自启动

systemclt enable httpd.service

至此apache安装完毕

安装mod_ssl

yum -y install mod_ssl

安装mariadb

1.首先设置数据源

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

2.更新缓存

yum clean all  
yum makecache  
yum repolist

3.显示可安装的版本

#这个可以看版本号
yum search mariadb –showduplicates 

yum search mariadb

4.安装

sudo yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

5.启动服务

systemctl enable mariadb –now

6.配置数据库

mysql_secure_installation

首先是设置密码,会提示先输入密码

Enter current password for root (enter for none):<–初次运行直接回车

设置密码

Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码

其他配置

Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车

Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,

Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车

Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车

初始化MariaDB完成,接下来测试登录

mysql -uroot -ppassword

设置数据库允许远程连接:

mysql -uroot -p(进入数据库)

查看MySQL库中的user表(user表中存着链接信息)

select host,user from user;

使用更新语句是root用户可以在任意IP的电脑上登录

update user set host=’%’,user=’root’ limit 1;

使修改生效

flush privileges;

退出Mariadb后并重启 mariadb服务

systemctl restart mariadb

至此,数据库安装完毕

安装php

1.首先安装 EPEL 源:

yum install epel-release

2.安装 REMI 源:

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3.安装 Yum 源管理工具:

yum install yum-utils

4.安装 PHP7.3:

yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll

5.启动php:

systemctl enable php73-php-fpm(开机自启动)
systemctl start php73-php-fpm(启动)

配置apache虚拟机

在/etc/httpd/conf.d文件夹新建一个conf配置文件,再把以下内容拷贝到里面

例如:

  
    DocumentRoot “/var/www/html/web/app/public_html”   #项目根目录
    ServerName lottery.yidianhulian.com  #绑定的域名
       
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
    DirectoryIndex index.php index.html error/index.html
 
  ErrorDocument 400 /error/400.html
  ErrorDocument 403 /error/403.html
  ErrorDocument 404 /error/404.html
  ErrorDocument 500 /error/500.html
  ErrorDocument 501 /error/501.html
  ErrorDocument 502 /error/502.html
  ErrorDocument 503 /error/503.html
  ErrorDocument 504 /error/504.html
  ErrorDocument 505 /error/505.html
  ErrorDocument 506 /error/506.html
  ErrorDocument 507 /error/507.html
  ErrorDocument 510 /error/510.html

配置https

1.使用域名可以申请免费的ssl证书,选择apache版本,证书一共有三个文件,例如:

2.在服务器中新建一个文件夹,把这三个文件拷贝到里面

3.配置https其实就是配置/etc/httpd/conf.d/ssl.conf文件,使用yum下载mod_ssl后会自动生成这个文件。对文件进行配置,例如:

#
# When we also provide SSL we have to listen to the 
# the HTTPS port in addition.
#
Listen 443 https

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin’ is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism 
#   to use and second the expiring timeout (in seconds).
SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout  300

#   Pseudo Random Number Generator (PRNG):
#   Configure one or more sources to seed the PRNG of the 
#   SSL library. The seed data should be of good random quality.
#   WARNING! On some platforms /dev/random blocks if not enough entropy
#   is available. This means you then cannot use the /dev/random device
#   because it would lead to very long connection times (as long as
#   it requires to make more entropy available). But usually those
#   platforms additionally provide a /dev/urandom device which doesn’t
#   block. So, if available, use this one instead. Read the mod_ssl User
#   Manual for more details.
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random  512
#SSLRandomSeed connect file:/dev/random  512
#SSLRandomSeed connect file:/dev/urandom 512

#
# Use “SSLCryptoDevice” to enable any supported hardware
# accelerators. Use “openssl engine -v” to list supported
# engine names.  NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly. 
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

##
## SSL Virtual Host Context
##

      #找到这个标签

# General setup for the virtual host, inherited from global configuration
ServerName lottery.yidianhulian.com   #配置域名
DocumentRoot /var/www/html/web/app/public_html  #配置项目根目录

  #添加这个标签允许访问该项目
 
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
    DirectoryIndex index.php index.html error/index.html
 

# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   SSL Protocol support:
# List the enable protocol levels with which clients will be able to
# connect.  Disable SSLv2 access by default:
SSLProtocol all -SSLv2 -SSLv3  # 添加SSL协议支持协议,去掉不安全的协议。

#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM   # 修改加密套件。

#   Speed-optimized SSL Cipher configuration:
#   If speed is your main concern (on busy HTTPS servers e.g.),
#   you might want to force clients to specific, performance
#   optimized ciphers. In this case, prepend those ciphers
#   to the SSLCipherSuite list, and enable SSLHonorCipherOrder.
#   Caveat: by giving precedence to RC4-SHA and AES128-SHA
#   (as in the example below), most connections will no longer
#   have perfect forward secrecy – if the server’s key is
#   compromised, captures of past or future traffic must be
#   considered compromised, too.
#SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
SSLHonorCipherOrder on 

#   Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
#SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateFile /etc/httpd/cert/4520877_lottery.yidianhulian.com_public.crt  #证书所在目录。要一一对应,注意看文件名

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you’ve both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/httpd/cert/4520877_lottery.yidianhulian.com.key  #证书所在目录。要一一对应,注意看文件名

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
SSLCertificateChainFile /etc/httpd/cert/4520877_lottery.yidianhulian.com_chain.crt  #证书所在目录。要一一对应,注意看文件名

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.  
#
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
#            and %{SSL_CLIENT_S_DN_O} eq “Snake Oil, Ltd.” \
#            and %{SSL_CLIENT_S_DN_OU} in {“Staff”, “CA”, “Dev”} \
#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line’ version of the client’s X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA’.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*’ environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o StrictRequire:
#     This denies access when “SSLRequireSSL” or “SSLRequire” applied even
#     under a “Satisfy any” situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context. 
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

    SSLOptions +StdEnvVars


    SSLOptions +StdEnvVars

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn’t wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is send or allowed to received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is send and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly. 
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable “nokeepalive” for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables “downgrade-1.0” and
#   “force-response-1.0” for this.
BrowserMatch “MSIE [2-5]” \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log \
          “%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \”%r\” %b”

ACL – 权限控制

权限控制

权限控制顾名思义就是控制什么“人”能(不能)访问什么(“操作”)。在身份认证中,我们已经知道了人是谁,现在这里就介绍yangzie如何控制这些人能做什么,yangzie是基于ACL来实现授权功能的,那么这里需要先阐明几个概念:

Access Control Object

ACO访问控制对象,也就是ARO要请求访问的对象,在yangzie中也就是M/C/A(见yangzie基本原则),每个具体的ACO也有一个标识,就按照M/C/A的格式进行标识,比如order模块下面的增加订单add,假如他都组织在index控制器下(index_controller),action为add;那么该ACO的标识就是:/order/index/add;

根据具体的业务要求,ACO可以定义到某个具体的Action级别,或者Controller级别或者整个module级别

Access Request Object

ARO访问请求对象,也就是要请求ACO的对象,通常他指“人”,各种各样的类型的人,每种“类型”有一个唯一的标识,用于区别一类人,比如某种角色的,也可以唯一标识一个人;

这个标识yangzie的设计是从大类/小类/具体某个用户id然后以/进行分割,举个例子,假如系统中存在这这几种角色,超级管理员,普通管理员,销售;可能这几种角色的ARO标识看起来是这个样子:

  • 超级管理员:/admin/root
  • 普通管理员:/admin/normal
  • 销售:/salesman
  • 管理员A:/admin/normal/12344

为什么要这样设计,是因为在进行授权时可以把权限分配给组或者具体某个类型或者具体某个人;然后具体的某个用户,如上面的管理员A,在验证权限时,再从具体id到大类来逐一验证,直到找到具体的权限是允许还是拒绝为止。

ACL

ARO和ACO分别定义了“操作”和“人”,那么剩下的就是把这两个关联起来,从而达到什么人能访问什么的目的;这个关联的地方就是AccessControlList;在yangzie中它是一个配置文件,位于app/__aros_acos__.php;默认的内容如下:


function yze_get_aco_desc($aconame) {
    foreach ( ( array ) yze_get_acos_aros () as $aco => $desc ) {
        if (preg_match ( "{^" . $aco . "}", $aconame )) {
            return @$desc ['desc'];
        }
    }
    return '';
}
function yze_get_ignore_acos() {
    return array();
}
function yze_get_acos_aros() {
    $array = array (
            "/" => array (//module/controller/action
                    "deny" => "",
                    "allow" => array (
                            "*" //aro
                    ),
                    "desc" => ""//功能说明 
            )
		);
    
	return $array;
}

该文件主要包含3个函数:

  • yze_get_acos_aros:该方法返回ACL列表
  • yze_get_ignore_acos:该方法返回忽略权限控制的ACO,当ARO请求这些内容时忽略权限控制
  • yze_get_aco_desc: 助手方法,返回ACO功能的描述,

ACL的格式

ACL是一个数组,格式如下:

array (
            "ACO1 name" => array (
                    "deny" => "",//拒绝的ARO
                    "allow" => array (
                            "*" //允许的ARO
                    ),
                    "desc" => ""//ACO功能说明 
            ),
            "ACO2 name" => array (
                    "deny" => "",//拒绝的ARO
                    "allow" => "*", //允许的ARO,
                    "desc" => ""//ACO功能说明 
            ),
);

ACO name是ACO的标识,根据权限控制的级别可以具体定义到Action级别,或者只定义到Module级别;

deny定义黑名单,拒绝里面列出的ARO的访问;allow定义白名单,允许里面列出的ARO

ACL定义规则

  1. ACO和ARO都可以使用正则表达
  2. 黑名单优先级大于白名单
  3. 两者都可以采用”*”来代表所有
  4. 如果要指定具体的aro,deny和allow中以数组的形式列出ARO

一个真实的例子:


function yze_get_ignore_acos() {
    return array(
            "/card/front",
            "/package/package/grab",
            "/package/package/grabfail",
            "/package/front",
            "/zb/middlepage/view",
            "/wxbbs/front",
            "/zbad/front",
    );
}
function yze_get_acos_aros() {
    $array = array (
            "/admin" => array (
                    "deny" => "*",
                    "allow" => array (
                            "/admin" 
                    ),
                    "desc" => "后端管理" 
            ),
            "/sp/consumers" => array (
                    "deny" => "*",
                    "allow" => array (
                            "/sp"
                    ),
                    "desc" => "粉丝管理"
            )
    );
    if (YDWXP_TYPE == YDWXP_TYPE_MARKET || YDWXP_TYPE == YDWXP_TYPE_ALL) {
        $array ['/card'] = array (
                "deny" => "*",
                "allow" => array ("/sp"),
                "desc" => "卡券管理" 
        );
        $array ['/card/card/*consume'] = array (
                "deny" => "*",
                "allow" => array ("/sp"),
                "desc" => "卡券核销"
        );
        $array ['/card/merchants'] = array (
                "deny" => "*",
                "allow" => array ("/sp/super","/sp/common"),
                "desc" => "商户管理" 
        );
    }
    
	return $array;
}

ARO怎么定义

ACO是根据M/C/A来定义的,这很明确和具体,但ARO标识怎么根据用户来定义?这也是通过hook来实现的,在app/hooks/auth.php中已经定义注册了该hook,开发者只需要实现即可,这里有一个真实的例子:


YZE_Hook::add_hook ( YZE_FILTER_GET_USER_ARO_NAME, function  ( $data ) {
	if ( !@$_SESSION [ 'admin' ] )return "/";
	if(is_a($_SESSION['admin'], "\\app\\sp\\Consumer_Model")){
	   return "/consumer";
	}
    if($_SESSION [ 'admin' ]->sp_id) {
       //是否子商户
       if ( ! isset($_SESSION [ 'is_sub_merchant' ]) ) {
           $_SESSION [ 'is_sub_merchant' ] = YZE_Hook::do_hook(YDMARKET_IS_SUB_MERCHANT, $_SESSION [ 'admin' ]->sp_id);
       }
       if ($_SESSION [ 'is_sub_merchant' ]) {
           return "/".$_SESSION [ 'admin' ]->user->type."/sub/".$_SESSION [ 'admin' ]->type;
       }
    }
	return "/".$_SESSION [ 'admin' ]->user->type."/".$_SESSION [ 'admin' ]->type;
} );

根据自己的业务系统的用户类型,自行设计自己的ARO标识接口。

能灵活的配置权限吗?

ACL列表属于事先硬编码的控制列表,但在实际的业务环节中很多权限都是需要动态分配的,比如给某中角色设置权限,给具体某个人设置权限;这在yangzie中如何做呢?

yangzie有两个预留函数get_permissions($aroname),get_user_permissions()

这两个函数由开发者实现,分别返回指定aroname的acl或者返回某个具体用户的acl,这通常是具体的业务要求决定的,返回的仍然是acl数组结构。这两个函数放在任意的自动包含文件中(见__config__.php说明),但要注意

这两个函数必须属于顶级命名空间

当有这两个函数的实现时,他们的返回结果将覆盖ACL里面的控制

ACL的效果是什么

当配置好ACL后,如果一个用户访问被deny的内容,如某个action,某个controller或者某个module;yangzie将会抛出YZE_Permission_Deny_Exception异常,开发者可以通过hook YZE_FILTER_YZE_EXCEPTION来监听然后做响应的处理,默认情况下将显示500页面;

这就是说yangzie会根据ACL来验证用户的权限,如果用户没有权限就会立即抛出异常,这在进入开发者的业务逻辑之前就已经处理,开发者无需在自己的功能代码中去验证当前用户是谁,是否有权限方法;开发者就只关注自己的业务逻辑即可。

GET和POST的特殊情况

yangzie的Action包含两种情况,get方式和post方法,比如一个增加用户的例子,假如M/C/A是:users/index/add;那么他对应的post action就是users/index/post_add,会多一个post前缀,如果在ACL需要针对这两种情况单独控制,比如允许get但不允许post,也就是允许看,但不允许提交,那在ACL中需要分配针对两个action(add,post_add)进行处理

如何通过ACL来控制输出

在实际的业务系统中,通常需要根据权限来控制输出的响应中某些部分用户可见,某些部分用户不可见,那么这可以通过两种方式来实现。

方法一:通过YZE_ACL::get_instance()->check_byname($aroname, $aconame)来判断并输出


if(YZE_ACL::get_instance()->check_byname($aroname, $aconame)){

// your output html

}

方法二:通过YZE_ACL::get_instance()->begin_check_permission($id, $aroname, $aconame)….YZE_ACL::get_instance()->end_check_permission($id, $aroname, $aconame)来输出


YZE_ACL::get_instance()->begin_check_permission($id, $aroname, $aconame)

// your output html

YZE_ACL::get_instance()->end_check_permission($id, $aroname, $aconame)

根据你的习惯来选择,如果你不喜欢跨度很大的if(){},那用第二种方式是个好选择

yangzie代码结构

yangzie的目录结构

yangzie 目录是框架核心文件

scripts是构建脚本目录

tests是单元测试文件目录

tmp是其他一些临时目录

app是功能代码目录,我们编写的功能代码都在其中

APP目录详细说明

  • __aros_acos__.php 该文件是ACL控制配置文件,这将在ACL控制中详细说明
  • __config__.php是系统的配置文件,包含如数据库配置资源打包绑定,文件包含登录
  • hooks是系统级别的hook注册文件放置目录
  • modules是功能模块目录,所有的业务功能代码都会以modules的方式放置在这里面
    • controllers是所有控制器类文件
    • models是所有的model文件,model是与数据库的表对应的类,这将在Model-数据处理中说明
    • views是控制器的方法对应的输出视图,这将在视图系统中进行介绍
    • hooks是该模块下的hooks文件
    • __module__.php是模块的配置文件
  • public_html是系统访问的入口目录,里面的目录可以自由组织存放
  • public_html/index.php就是入口文件
  • public_html/module-assets是modules对应的资源文件
  • vendor是其他第三方库,layout,views等系统公共部分部分的放置路径
  • vendor/layout存放的是系统的布局文件
  • vendor/views/存放的是公共视图

目录大概就了解这些,具体目录里面的含义我们会在后面继续详解。

接下来,开始写代码吧:《hello yangzie

配置Rewrite

  • 修改本地的hosts文件,加上127.0.0.1 yourdomain.com
    Windows Mac & Linux
    C:\WINDOWS\system32\drivers\etc\hosts /etc/hosts
  • 配置rewrite
    Apache Ngnix
    0. 启用rewrite module:
    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    1. 修改apache配置文件httpd.conf, 取消下面这行代码的注释
    Include /private/etc/apache2/extra/httpd-vhosts.conf
    去掉前面的#
    2. 修改httpd-vhosts.conf<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot “/path-to-your-yangzie-dir/app/public_html”
    ServerName YOUR-DOMAIN.com
    ServerAliasYOUR-DOMAIN.com
    ErrorLog “/path-to-your-log-dir/YOUR-DOMAIN.com-error_log”
    CustomLog “/path-to-your-log-dir/YOUR-DOMAIN.com-access_log” common
    <Directory “/path-to-your-yangzie-dir/app/public_html”>
    AllowOverride All
    Require all granted
    </Directory>
    </VirtualHost># 如果localhost不能访问,则加上下面这句
    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot “/path-to-your-localhost-dir”
    ServerName localhost
    ErrorLog “/path-to-your-log-dir/localhost-error_log”
    CustomLog “/path-to-your-log-dir/localhost-access_log” common
    <Directory “/path-to-your-localhost-dir”>
    Options All
    AllowOverride All
    Require all granted
    </Directory>
    </VirtualHost>
    1. 修改nginx配置文件如下:
    server {
    root path-to-your-yangzie-dir/app/public_html;
    index index.html index.php index.htm;server_name YOUR_DOMAIN.com
    }

yangzie-PHP 一个恰到好处的小巧的PHP开发框架

yangzie是什么?

一个 PHP 框架;仅此而已。

你问它有什么优点?其实它的优点别的框架都有,它的缺点别的框架也有。

那为什么它有存在的价值?因为我不想重复:我不想在同一个项目中写重复的代码;我不想在不同的项目中写重复的代码;我不想年复一年的写重复的代码。

yangzie是一个轻便简洁的php快速开发框架,采用MVC开发模式,基于module来开发组织功能;在M、V、C和module各方面都尽力做到重用

如何使用?

  1. 下载代码 https://github.com/ydhl/yangzie
  2. 配置本地虚拟域名
  3. 完成!打开浏览器,访问YOUR-DOMAIN.com
  4. 如果你本地安装的是php5.4 以上的版本,则无需配置apache,只需
    1. cd 进入到项目的public_html目录
    2. php -S localhost:8080
    3. 浏览器直接访问localhost:8080 即可

接下来

本文档将解释如何使用yangzie来开发,你只需根据我们的节奏一步一步走下去

了解一下《1.yangzie的目录结构》,知道自己写的代码在哪里


为什么叫yangzie?

扬子鳄(Alligator sinensis)或称作鼍(tuó), 是中国特有的一种鳄鱼,是世界上最鳄鱼

第八届PHP开发者峰会将于10/17日在上海华纳风格酒店举行

10月17日日程

时间内容
08:30 – 09:00签到入场
09:00 – 09:20大会开场、抽奖
09:30 – 10:15《What’s new in PHP 8.0?》——Nikita
10:30 – 11:15《次时代Swoole, 青年PHP的无尽探索》——Twosee
11:30 – 12:15《PHP 下 AOP 的实现与原理》——黄朝晖
14:00 – 14:45《PHP安全开发规范与审查》——汤青松
15:00 – 15:45《PHP大规模服务化的实践过程》——丁盼盼
16:00 – 16:45《开源治理与数字化转型》——庄表伟
16:45 – 17:00抽奖

10月18日日程

时间内容
09:00 – 09:20抽奖
09:30 – 10:15《疫情之下K12在线教育系统的稳定性建设》——陈雷
10:30 – 11:15韩天峰的演讲
11:30 – 12:15惠新宸的演讲
14:00 – 14:45《从开源项目汲取养分助力业务发展》——景罗
15:00 – 15:45《SRE如何提高服务的质量和稳定性》——刘征
16:00 – 16:45《从总监到自由》——lukin
16:45 – 17:00抽奖