duanlu1279
2017-01-03 05:48
浏览 233
已采纳

PhP本地主机重定向到/var/www/html/index.php

I am using Ubuntu machine. I am running lampp server for php files.

I have all my PHP files in my_folder where I have all my codes in /opt/lampp/htdocs/my_folder including index file in /opt/lampp/htdocs/my_folder/index.php.

I wanted to check my codes by running http://localhost/index.php in Chrome browser, but for some reason it keeps directing me to /var/www/html/html.index file. Can someone please help me resolve this problem?

Thanks in advance.

图片转代码服务由CSDN问答提供 功能建议

我正在使用Ubuntu机器。 我正在为php文件运行lampp服务器。

我的所有PHP文件都在 my_folder 中,我的所有代码都在 / opt / lampp / htdocs / my_folder 中,包括索引 文件在 /opt/lampp/htdocs/my_folder/index.php

我想通过运行 http:// localhost /检查我的代码 Chrome浏览器中的index.php ,但出于某种原因,它一直指引我 /var/www/html/html.index 文件。 有人可以帮我解决这个问题吗?

提前致谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doudou20145 2017-01-03 05:51
    已采纳

    add this to you apache config.

    DocumentRoot /opt/lampp/htdocs/my_folder
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /opt/lampp/htdocs/my_folder>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    
    打赏 评论
  • duanliyi5997 2017-01-03 17:14

    Adittionally, If MySQL doesn't start:

    sudo /etc/init.d/apache2 stop
    sudo /etc/init.d/mysql stop
    sudo /etc/init.d/proftpd stop
    sudo /opt/lampp/lampp start
    
    打赏 评论

相关推荐 更多相似问题