A simple PHP program was tested to return 500 exceptions.

Source: Internet
Author: User
Tested a simple PHP program to return a 500 error ...
The operating system is Ubuntu12,apache2 installed correctly
PHP is apt-egt installation of PHP5, the installation process I have looked carefully, no hint error.
After the finished in accordance with international practice, helloworld a bit, the result:
Chrome tips:
=================================================================
Server error
The site encountered an error while retrieving http://192.168.1.107/helloworld.php. The site may be closed for maintenance or incorrectly configured.
=================================================
IE Tip: This error (HTTP 500 Internal server error) means that the Web site you are visiting has a server problem that prevents the page from appearing.
====================================

The PHP code is as follows:
echo "Hello World";
?>

PHP5 re-installed the same, ask why ...


------Solution--------------------
PHP does not parse?
------Solution--------------------
Even if it does, it should be--the browser.

echo "
";
echo "Hello World";
?>


------Solution--------------------
 
   Phpinfo ();
?>

Does this print?
------Solution--------------------
Citation:
Why can't Linux make a little improvement in ease of use for so many years? Can the security of the rigorous, traditional authority management offset the loss of efficiency? Puzzled


You re-apt-get the install once, the Apache Linux MySQL is loaded, now in Ubuntu to install this is more simple than under win. There is nothing wrong with basically installing normally. The problem is basically a compilation of their own parts
------Solution--------------------
777 is wrong.
The problem is that you execute PHP's process permissions
Please check which user you are using to execute PHP
And then
Chown Username:username Php_dir-r
------Solution--------------------
references:
guys, I found a solution on the Internet through another error log.
LOG: Permission denied in unknown on line 0

The solution is as follows
sudo chmod 777/var/www/helloworld.php
The result is good ...

Why is that? Do you want to do this for every PHP file in the future?


777 is the maximum privilege
for different users.
RWX rwx rwx You look at Linux directly is the corresponding owner rights user group permissions group other people permissions other
R-Read W-write X-Execute
Rwx for 4+2+1=7.
Assume that R-w is not a write permission 4+0+1=5

General situation 744
namely rwx r--r--
------Solution--------------------
The owner is assigned to the Apache execution user,
In general, Apache is available by default.

Chown Apache:apache helloword.php

------Solution--------------------
If you are loading so mode using PHP, then
Ps-ef
------Solution--------------------
grep httpd
------Solution--------------------
Grep-v grep
Then look at the leftmost column, which is the user name

References:
Reference: 777 is wrong
The problem is that you execute PHP's process permissions
Please check which user you are using to execute PHP
And then
Chown Username:username Php_dir-r

How do I check which user is executing PHP?

------Solution--------------------
You do not do server this piece, Linux understand some good, really want to do, you will find that Linux is very interesting, I instead feel that Windows products rotten, inefficient, tossing trouble. The last time to set a SQL password, just toss half a day ~
Citation:
Why can't Linux make a little improvement in ease of use for so many years? Can the security of the rigorous, traditional authority management offset the loss of efficiency? Puzzled
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.