按照前面的帖子,下载了一个XAMPP,根据说明测试成功了
谁能教教我怎么用呢
我创建了一个文本文档,命名为“text.php"
内容如下
然后呢,我该如何让它在firefox中显示出来呢?<html>
<title>PHP</title>
<body>
<?php
echo “Hello!”;
?>
</body>
</html>
似乎不能直接打开!
大家不要笑我,刚刚开始学习php,诚心向大家请教!
然后呢,我该如何让它在firefox中显示出来呢?<html>
<title>PHP</title>
<body>
<?php
echo “Hello!”;
?>
</body>
</html>
是不是要把这三个文件删除掉,然后把我自己的PHP页面文件拷贝进去?gongshu@gongshu-ubuntu:/opt/lampp/htdocs$ ls -al
总用量 20
drwxr-xr-x 4 nobody root 4096 2006-11-26 18:56 .
drwxr-xr-x 20 root root 4096 2007-02-17 16:24 ..
-rw-r--r-- 1 nobody root 163 2003-11-01 05:15 index.html
drwxr-xr-x 2 nobody root 4096 2004-12-26 18:30 webalizer
drwxr-xr-x 6 root root 4096 2006-11-26 18:56 xampp
gongshu@gongshu-ubuntu:/opt/lampp/htdocs$
代码: 全选
cd ~/Desktop
sudo vim test.php (不会vim的话直接可以 sudo gedit test.php)
里面输入内容:
<?php
echo "HelloWorld!";
?>
然后保存。
代码: 全选
sudo mv test.php /opt/lampp/htdocs/
代码: 全选
sudo /opt/lampp/./lampp start
是不是test.php文件的权限出了问题?root@gongshu-ubuntu:/opt/lampp/htdocs# ls -al
总用量 24
drwxr-xr-x 4 nobody root 4096 2007-03-18 22:04 .
drwxr-xr-x 20 root root 4096 2007-02-17 16:24 ..
-rw-r--r-- 1 nobody root 163 2003-11-01 05:15 index.html
-rw------- 1 gongshu gongshu 50 2007-03-18 22:04 test.php
drwxr-xr-x 2 nobody root 4096 2004-12-26 18:30 webalizer
drwxr-xr-x 6 root root 4096 2006-11-26 18:56 xampp
root@gongshu-ubuntu:/opt/lampp/htdocs# cat test.php
<?php
echo"<p>this is a PHP example.";
?>
root@gongshu-ubuntu:/opt/lampp/htdocs#
才能显示?[/quote]<html>
<title>test</title>
<body>
<?php
echo"<p>this is a PHP example.";
?>
</body>
</html>
显示错误信息如下
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required '/opt/lampp/htdocs/test.php' (include_path='.:/opt/lampp/lib/php') in Unknown on line 0
把文件权限改变以后就可以正确显示了!-rw-r--r-- 1 nobody root 163 2003-11-01 05:15 index.html
-r--r--r-- 1 gongshu gongshu 50 2007-03-18 22:04 test.php
drwxr-xr-x 2 nobody root 4096 2004-12-26 18:30 webalizer
drwxr-xr-x 6 root root 4096 2006-11-26 18:56 xampp
gongshu@gongshu-ubuntu:/opt/lampp/htdocs$
================================seanone 写了:ECHO和PHP里有没有HTML代码都没关系
建议你把/htdocs的权限改了,让你的登陆用户可以读写,我自己是这么弄的,这样用编辑器就可以在目录下直接存取,测试也方便.目前正在做PHP+AJAX功课呢.
至于会有什么样的安全隐患,大虾们会比较清楚些.