Tested a simple PHP program and returned error 500.

Source: Internet
Author: User
Tested a simple PHP program and returned error 500. 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...


Reply to discussion (solution)

PHP not parsed?


Not clear... They are all installed according to the internet. there is no problem in opening static webpages.

Even if it is parsed, what should we do ?? Browser

Echo"

";
Echo "hello world ";
?>


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

  

Is this printed?

Check the httpd log.

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.

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 ......

==================
Reinstalled.

I found APACHE error logs and some records that may be related to PHP. please help me diagnose them...
[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

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 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

We recommend that you do not grant 777 permissions to any file.
Generally, 744 is enough.

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

Okay. I want to find it. Thank you! Taught!

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 --

The owner is assigned to the apache execution user,
Apache is used by default.

chown apache:apache helloword.php

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

How can I check which user is executing PHP?

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

Reply to acabin referencing the 11 th floor: 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

How can I check which user is executing PHP?

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 ~
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

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 ~
Reply by referencing chilun on the fourth floor: why can't LINUX be improved in terms of ease of use after so many years? Can the security caused by strict permission management offset the loss of efficiency? Puzzled

Will other releases, such as REDHAT, be easier to use ...... UBUNTU is speechless.

Forget it. I gave up and used a LAMP installation package in WINDOWS. goodbye to UBUNTU ..

Thank you for your enthusiastic answers ~ Closed


.........

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.