A simple PHP program was tested to return an error 500.

Source: Internet
Author: User
Tested a simple PHP program and returned error 500... The operating system is UBUNTU12, APACHE2 installation error PHP is APT-EGT installed PHP5, installation process I have carefully checked, no error prompt. after completing the preceding steps, HELLOWORLD followed the international convention. Result: CHROME prompt: a simple PHP program is tested and error 500 is returned...
The operating system is UBUNTU12, and APACHE2 is installed correctly.
PHP is the installation of PHP5 APT-EGT, installation process I have carefully checked, no error prompt.
After the preceding settings, HELLOWORLD follows international conventions. The result is as follows:
CHROME prompt:
========================================================== ======================================
Server error
The website encountered an error when retrieving http: // 192.168.1.107/helloworld. php. The website may be closed for maintenance or the configuration is incorrect.
========================================================== ==========
IE prompt: this error (HTTP 500 Internal Server Error) means that the website you are visiting has a server problem, which prevents the web page from being displayed.
==========================================

The PHP code is as follows:
Echo "hello world ";
?>

The same is true when PHP5 is re-installed. why...


------ Solution --------------------
PHP not parsed?
------ Solution --------------------
Even if it is parsed, it should be like this-browser

Echo"
";
Echo "hello world ";
?>


------ Solution --------------------
  phpinfo();
?>

Is this printed?
------ Solution --------------------
Reference:
Why can't LINUX be improved in terms of ease of use over the years? Can the security caused by strict permission management offset the loss of efficiency? Puzzled


Run apt-get install again to install apache linux mysql. now it is much easier to download apache linux mysql in ubuntu than to download apache mysql in Windows. Basically, normal installation will not cause any problems. The problematic part is basically self-compiled.
------ Solution --------------------
777 is wrong
The problem is that you have the permission to execute php processes.
Check which user you use to execute the php
Then
Chown username: username php_dir-R
------ Solution --------------------
Reference:
Ladies and gentlemen, I found a solution on the Internet using 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 fine...

Why? Do I need to do this for every php file in the future?


777 is the maximum permission
For different users
Rwx in linux, you can see that this corresponds to the owner permission, user group permission, group permission, and other permissions, other respectively.
R-read w-write x-execute
Rwx has 4 + 2 + 1 = 7
Assume that r-w has no write permission. 4 + 0 + 1 = 5.

Generally 744
Rwx r --
------ Solution --------------------
The owner is assigned to the apache execution user,
Apache is used by default.

chown apache:apache helloword.php

------ Solution --------------------
If the so mode is loaded and php is used
Ps-ef
------ Solution --------------------
Grep httpd
------ Solution --------------------
Grep-v grep
Then look at the leftmost column, which is the user name.

Reference:
Reference: 777 is incorrect.
The problem is that you have the permission to execute php processes.
Check which user you use to execute the php
Then
Chown username: username php_dir-R

How can I check which user is executing PHP?

------ Solution --------------------
If you don't use a server, you just need to know about linux. you will find that linux is quite interesting. Instead, I think windows products are bad, inefficient, and troublesome. The last time I set a password for an SQL statement, I had to wait for half a day ~
Reference:
Why can't LINUX be improved in terms of ease of use over the years? Can the security caused by strict permission 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.