douhaoqiao9304 2014-03-20 10:15
浏览 75
已采纳

php maverick htaccess未在端口上解析:8888

I've install a dev environment on my mac running os x maverick and everything works fine excepted url rewriting.

To be exact, when I go to localhost on the default port, it works.

but when I go to the website folder in terminal and I start apache on the port :8888 using this command:

php -S localhost:8888

then the .htaccess is not read.

I want to work this way in order to have my server logs in the terminal.

What is the problem?

This is my httpd.conf file:

ServerRoot "/usr"

    Listen 80

    LoadModule authn_file_module libexec/apache2/mod_authn_file.so
    LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
    LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
    LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
    LoadModule authn_default_module libexec/apache2/mod_authn_default.so
    LoadModule authz_host_module libexec/apache2/mod_authz_host.so
    LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
    LoadModule authz_user_module libexec/apache2/mod_authz_user.so
    LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
    LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
    LoadModule authz_default_module libexec/apache2/mod_authz_default.so
    LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
    LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
    LoadModule cache_module libexec/apache2/mod_cache.so
    LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
    LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
    LoadModule dbd_module libexec/apache2/mod_dbd.so
    LoadModule dumpio_module libexec/apache2/mod_dumpio.so
    LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
    LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
    LoadModule include_module libexec/apache2/mod_include.so
    LoadModule filter_module libexec/apache2/mod_filter.so
    LoadModule substitute_module libexec/apache2/mod_substitute.so
    LoadModule deflate_module libexec/apache2/mod_deflate.so
    LoadModule log_config_module libexec/apache2/mod_log_config.so
    LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
    LoadModule logio_module libexec/apache2/mod_logio.so
    LoadModule env_module libexec/apache2/mod_env.so
    LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
    LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so
    LoadModule expires_module libexec/apache2/mod_expires.so
    LoadModule headers_module libexec/apache2/mod_headers.so
    LoadModule ident_module libexec/apache2/mod_ident.so
    LoadModule usertrack_module libexec/apache2/mod_usertrack.so
    #LoadModule unique_id_module libexec/apache2/mod_unique_id.so
    LoadModule setenvif_module libexec/apache2/mod_setenvif.so
    LoadModule version_module libexec/apache2/mod_version.so
    LoadModule proxy_module libexec/apache2/mod_proxy.so
    LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
    LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
    LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
    LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
    LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
    LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
    LoadModule ssl_module libexec/apache2/mod_ssl.so
    LoadModule mime_module libexec/apache2/mod_mime.so
    LoadModule dav_module libexec/apache2/mod_dav.so
    LoadModule status_module libexec/apache2/mod_status.so
    LoadModule autoindex_module libexec/apache2/mod_autoindex.so
    LoadModule asis_module libexec/apache2/mod_asis.so
    LoadModule info_module libexec/apache2/mod_info.so
    LoadModule cgi_module libexec/apache2/mod_cgi.so
    LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
    LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
    LoadModule negotiation_module libexec/apache2/mod_negotiation.so
    LoadModule dir_module libexec/apache2/mod_dir.so
    LoadModule imagemap_module libexec/apache2/mod_imagemap.so
    LoadModule actions_module libexec/apache2/mod_actions.so
    LoadModule speling_module libexec/apache2/mod_speling.so
    LoadModule userdir_module libexec/apache2/mod_userdir.so
    LoadModule alias_module libexec/apache2/mod_alias.so
    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    #LoadModule perl_module libexec/apache2/mod_perl.so
    LoadModule php5_module libexec/apache2/libphp5.so
    LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so

    <IfModule !mpm_netware_module>
    <IfModule !mpm_winnt_module>

    User _www
    Group _www

    </IfModule>
    </IfModule>


    ServerAdmin you@example.com


    DocumentRoot "/Library/WebServer/apachesites"

    <Directory />
        Options FollowSymLinks
        AllowOverride all
        Order deny,allow
        Deny from all
    </Directory>
    <Directory "/Library/WebServer/apachesites">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all

    </Directory>

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>

    <FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
        Order allow,deny
        Deny from all
        Satisfy All
    </FilesMatch>

    <Files "rsrc">
        Order allow,deny
        Deny from all
        Satisfy All
    </Files>
    <DirectoryMatch ".*\.\.namedfork">
        Order allow,deny
        Deny from all
        Satisfy All
    </DirectoryMatch>

    ErrorLog "/private/var/log/apache2/error_log"

    LogLevel warn

    <IfModule log_config_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common

        <IfModule logio_module>
          # You need to enable mod_logio.c to use %I and %O
          LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>


        CustomLog "/private/var/log/apache2/access_log" common


    </IfModule>

    <IfModule alias_module>

        ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"

    </IfModule>

    <IfModule cgid_module>

    </IfModule>


    <Directory "/Library/WebServer/CGI-Executables">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>


    DefaultType text/plain

    <IfModule mime_module>
        TypesConfig /private/etc/apache2/mime.types

        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz

    </IfModule>

    TraceEnable off

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

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

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

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

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

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

    <IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    </IfModule>

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

And this is httpd-vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/Library/WebServer/apachesites"
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:8888>
    DocumentRoot "/Library/WebServer/apachesites"
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>

展开全部

  • 写回答

1条回答 默认 最新

  • drfkl66684 2014-03-20 10:18
    关注

    The built-in HTTP server ran by php -S is not Apache, thus there's no .htaccess nor mod_rewrite or any fancy stuff

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 HDL串口设计debug
  • ¥15 设计出USBDM硬件实物
  • ¥15 复现图像修复算法PD-GAN模型(基于概率多样性GAN)
  • ¥15 信息管理系统的排序和查找
  • ¥15 vscode请求各位指导
  • ¥50 有偿求qftp工具。能连接,下载文件,发送代码,windows环境,最好qt6 要qt creator写的
  • ¥70 刚刚看到一个人的网站居然是通过cname访问的
  • ¥15 逆置单链表输出不完整
  • ¥15 宇视vms-B200-A16@R启动不了,如下图所示,在软件工具搜不到,如何解决?(操作系统-linux)
  • ¥500 寻找一名电子工程师完成pcb主板设计(拒绝AI生成式答案)
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部