duanping3587 2015-07-22 12:31
浏览 218
已采纳

找不到 - 在此服务器上找不到请求的URL / app / example

I have followed the tutorial to get started with Symfony

https://symfony.com/doc/current/quick_tour/the_big_picture.html

and I have first set up a development environment using Vagrant: I created the virtual machine Ubuntu, and it seems that the files in the virtual machine are synchronised with my current Symfony project directory.

When I try to start the server locally from the project folder with the following command:

php console server:run

or (depending on my current directory)

php app/console server:run

I get the following error/warning:

[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system'
s timezone settings. You are required to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those me
thods and you are still getting this warning, you most likely misspelled th
e timezone identifier. We selected the timezone 'UTC' for now, but please s
et date.timezone to select your timezone.

But apparently this is not a problem, and it is not my actual problem.

I have associated the port 80 of the virtual machine with the port 4567 in my local computer, as explained in the tutorial of Vagrant, by typing the following command in the Vagrantfile:

config.vm.network :forwarded_port, guest: 80, host: 4567

Now, in the Symfony tutorial I am following, to see the initial page, I have to type the following command in the browser URL entry box:

http://localhost:8000/app/example

But it does not work, because of course I need to use another port, so I try with:

 http://localhost:4567/app/example

and I get the following page:

enter image description here

  • 写回答

1条回答 默认 最新

  • dongsi2317 2015-07-22 14:35
    关注

    I was receiving the following error/warning:

    [Symfony\Component\Debug\Exception\ContextErrorException] Warning: date_default_timezone_get(): It is not safe to rely on the system' s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those me thods and you are still getting this warning, you most likely misspelled th e timezone identifier. We selected the timezone 'UTC' for now, but please s et date.timezone to select your timezone

    When I run the following command on the terminal:

    php app/console server:run
    

    I decided to try to fix this error/warning, and at the end it started working.

    I fixed that warning by following the instructions of the second part of the following answer:

    https://stackoverflow.com/a/20743237/3924118

    To the question

    Symfony2 and date_default_timezone_get() - It is not safe to rely on the system's timezone settings

    But strangely, I need to use the original port 8000, instead of 4567:

    http://localhost:8000/app/example
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 xshell无法连接提示ssh服务器拒绝密码
  • ¥15 AT89C52单片机C语言关于串口通信的位操作
  • ¥20 需要步骤截图(标签-服务器|关键词-map)
  • ¥50 gki vendor hook
  • ¥15 灰狼算法和蚁群算法如何结合
  • ¥15 这是一个利用ESP32自带按键和LED控制的录像代码,编译过程出现问题,请解决并且指出错误,指导如何处理 ,协助完成代码并上传代码
  • ¥20 stm32f103,hal库 hal_usart_receive函数接收不到数据。
  • ¥20 求结果和代码,sas利用OPTEX程序和D-efficiency生成正交集
  • ¥50 adb连接不到手机是怎么回事?
  • ¥20 抓取数据时发生错误: get_mooncake_data() missing 1 required positional argument: 'driver'的问题,怎么改出正确的爬虫代码?