Php Config

启动 apache 服务

sudo apachectl start

重启命令

sudo apachectl restart

停止命令

 sudo apachectl stop

编辑 http.conf 配置文件

sudo vim /etc/apache2/httpd.conf

找到 LoadModule php5_module libexec/apache2/libphp5.so

LoadModule php5_module libexec/apache2/libphp5.so前面的注释(也就是#号去掉)

php 项目的路径

open /Library/WebServer/Documents

修改虚拟主机

sudo vim /private/etc/apache2/extra/httpd-vhosts.conf
   <VirtualHost *:80>
       ServerAdmin elk.backend.com
       DocumentRoot "/Library/WebServer/Documents/app-api-backend-master/app/app-api/public"
       ServerName elk.backend.com
       ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
       CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
   </VirtualHost>

   <VirtualHost *:80>
       ServerAdmin elk.web.com
       DocumentRoot "/Library/WebServer/Documents/app-api-web-master/public"
       ServerName elk.web.com
       ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
       CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
   </VirtualHost>
<VirtualHost *:80>
    ServerAdmin elk.backend.com
    DocumentRoot "/Library/WebServer/Documents/app-api-backend-master/app/app-api/public"
    ServerName elk.backend.com
    ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
 <Directory "/Users/yourname/Dev/xiaohua.com">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin elk.web.com
    DocumentRoot "/Library/WebServer/Documents/app-api-backend-master/app/app-api/public"
    ServerName elk.web.com
    ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
 <Directory "/Users/yourname/Dev/xiaohua.com">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
    </Directory>
</VirtualHost>
   <Directory "/Users/zhengjunling/WebServer/Documents/">
       Options Indexes MultiViews
       AllowOverride All
       Require all granted
   </Directory>

伪静态设置

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/(css|js|images|ajax)/.*$
RewriteRule ^(.+)$ /index.php/$1
<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/(css|js|images|ajax)/.*$
    RewriteRule ^(.+)$ /index.php/$1
    ServerAdmin elk.backend.com
    DocumentRoot "/Users/zhengjunling/WebServer/Documents/app-api-backend-master/app/app-api/public"
    ServerName elk.backend.com
    ErrorLog "/private/var/log/apache2/elk.backend.com-error_log"
    CustomLog "/private/var/log/apache2/elk.backend.com-access_log" common
 <Directory "/Users/zhengjunling/WebServer/Documents/app-api-backend-master/app/app-api/public">
Options Indexes MultiViews FollowSymlinks
                AllowOverride None
                Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/(css|js|images|ajax)/.*$
    RewriteRule ^(.+)$ /index.php/$1
    ServerAdmin elk.web.com
    DocumentRoot "/Users/zhengjunling/WebServer/Documents/app-api-web-master/public"
    ServerName elk.web.com
    ErrorLog "/private/var/log/apache2/elk.web.com-error_log"
    CustomLog "/private/var/log/apache2/elk.web.com-access_log" common
 <Directory "/Users/zhengjunling/WebServer/Documents/app-api-web-master/public">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Require all granted
 </Directory>
</VirtualHost>

export PATH=/usr/local/php5-7.3.8-20190811-205217/bin:$PATH

lumen 启动

php -S localhost:8000 -t public