测试了个简单的PHP程序返回500错误。
操作系统为UBUNTU12,APACHE2安装无误
PHP是APT-EGT安装的PHP5,安装过程我都仔细瞅了,没提示错误.
弄好了之后就按照国际惯例,HELLOWORLD了一下,结果:
CHROME提示:
=================================================================
服务器错误
网站在检索 http://192.168.1.107/helloworld.php 时遇到错误。 该网站可能关闭进行维护或配置不正确。
=================================================
IE提示:此错误(HTTP 500 内部服务器错误)意味着你正在访问的网站出现了服务器问题,此问题阻止了该网页的显示。
====================================
PHP代码如下:
echo "hello world";
?>
PHP5重新安装了也一样,求教为什么。。。
回复讨论(解决方案)
PHP没有解析?
不清楚。。。都是按照网上的说法安装的,静态网页打开没有问题啊
就算解析了,也要这样??浏览器啊
echo "
"; <br> echo "hello world"; <br> ?> <br> <br> <p class="sougouAnswer"> <br> 这么多年了,LINUX为什么不能在易用性方面做一点点改善?通过严苛古板的权限管理带来的安全能抵消效率损失吗?不解 </p> <p class="sougouAnswer"> <pre class='brush:php;toolbar:false;'><?phpphpinfo();?>
这个打印得出吗?
另外检查一下HTTPD LOG。
这么多年了,LINUX为什么不能在易用性方面做一点点改善?通过严苛古板的权限管理带来的安全能抵消效率损失吗?不解
你重新apt-get install 一次吧 把 apache linux mysql 都给装上,现在在ubuntu 下装这个比在win下简单多了。基本上正常安装的话不会存在有什么问题。有问题的基本上都是自己编译的部分
你重新apt-get install 一次吧 把 apache linux mysql 都给装上,现在在ubuntu 下装这个比在win下简单多了。基本上正常安装的话不会存在有什么问题。有问题的基本上都是自己编译的部……
=============
重新装了还是这样
我找到了APACHE的错误日志,发现了一些可能跟PHP有关的记录,请大家帮忙诊断一下。。。
[Sun Dec 02 15:20:18 2012] [notice] caught SIGTERM, shutting down
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/msql.so' - /usr/lib/php5/20100525/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
各位,我通过另一条错误日志在网上搜索到了一个解决办法
日志:permission denied in unknown on line 0
解决办法如下
sudo chmod 777 /var/www/helloworld.php
结果就好了。。。
这是为什么啊?难道以后每一个PHP文件都要这么弄?
777是错的
问题在于你执行php的进程的权限
请检查你用哪个用户执行的php
然后
chown username:username php_dir -R
建议对任意一个文件都不要给777权限
一般情况下给744就够了
777是错的
问题在于你执行php的进程的权限
请检查你用哪个用户执行的php
然后
chown username:username php_dir -R
好的,我找找。多谢!受教了!
各位,我通过另一条错误日志在网上搜索到了一个解决办法
日志:permission denied in unknown on line 0
解决办法如下
sudo chmod 777 /var/www/helloworld.php
结果就好了。。。
这是为什么啊?难道以后每一个PHP文件都要这么弄?
777是最大权限
针对不同的用户的
rwx rwx rwx 你在linux直接看是这样的 分别对应 所有者权限user 用户组权限group 其他人权限other
r-读 w-写 x-执行
rwx都有为4+2+1=7
假设r-w 即没有写的权限 4+0+1=5
一般情况744
即 rwx r-- r--
将属主指定给apache的执行用户,
一般默认为apache就可以了。
chown apache:apache helloword.php
777是错的
问题在于你执行php的进程的权限
请检查你用哪个用户执行的php
然后
chown username:username php_dir -R
请问如何检查是哪个用户在执行PHP啊?
如果是加载so模式使用php,那么
ps -ef | grep httpd | grep -v grep
然后看最左一列,就是用户名
引用 11 楼 acabin 的回复:777是错的
问题在于你执行php的进程的权限
请检查你用哪个用户执行的php
然后
chown username:username php_dir -R
请问如何检查是哪个用户在执行PHP啊?
你不做服务器这块,linux 了解一些就好,真要做了,你会发现linux 挺有意思的, 我反而觉得windows 的产品烂,低效,折腾着麻烦。 上次就设置一个sql 的密码,硬是折腾半天~
这么多年了,LINUX为什么不能在易用性方面做一点点改善?通过严苛古板的权限管理带来的安全能抵消效率损失吗?不解
你不做服务器这块,linux 了解一些就好,真要做了,你会发现linux 挺有意思的, 我反而觉得windows 的产品烂,低效,折腾着麻烦。 上次就设置一个sql 的密码,硬是折腾半天~
引用 4 楼 chilun 的回复:这么多年了,LINUX为什么不能在易用性方面做一点点改善?通过严苛古板的权限管理带来的安全能抵消效率损失吗?不解
其他的发行版比如REDHAT之类的会不会好用一些啊……UBUNTU真的无语了
算了,我放弃了,下了个LAMP安装包在WINDOWS下用了,UBUNTU再见。。
谢谢各位的热心解答~结贴了
.........

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Alipay PHP...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

An official introduction to the non-blocking feature of ReactPHP in-depth interpretation of ReactPHP's non-blocking feature has aroused many developers' questions: "ReactPHPisnon-blockingbydefault...
