我在哪里把我的世界,你好PHP文件在Ubuntu? [英] Where do I put my Hello world PHP file on Ubuntu?

查看:208
本文介绍了我在哪里把我的世界,你好PHP文件在Ubuntu?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想学习PHP的,我已经安装了它命令和apt-get安装PHP5我的Ubuntu 14.04的机器上。我看这也安装了Apache。

现在我已经创建了我的计划,我已经其保存到PHP文件。

 < PHP的echo'< P>的Hello World< / P>'; ?>

我知道我需要使用像 HTTP://localhost/myfile.php ,但如果我把文件,这样Apache会看到它? / p>

解决方案

选择一个名称,它可以让使用 hello.php 的这个例子。

在Ubuntu的文件夹是的/ var / www / html等,而不是 /无功/网络。您将需要为root访问权限。所以,你该文件保存为 /var/www/html/hello.php

打开Web浏览器并输入以下地址:

本地主机/ hello.php

和BAM。有你的页面。

So I want to learn PHP, and I've installed it with "sudo apt-get install php5" on my Ubuntu 14.04 machine. I see it also installed Apache.

Now I've created my program, and I've saved it to a php file.

 <?php echo '<p>Hello World</p>'; ?> 

I know that I need to use something like http://localhost/myfile.php, but where do I put the file, so Apache will see it?

解决方案

Pick a name for it lets use hello.php for this example.

On Ubuntu the folder is /var/www/html, NOT /var/www. You will need root access for that. So you save the file as /var/www/html/hello.php.

Open up a web browser and enter the following address:

localhost/hello.php

And BAM. There's you page.

这篇关于我在哪里把我的世界,你好PHP文件在Ubuntu?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆