Why my little brother? My local environment cannot parse the PHP file under subdirectories

Source: Internet
Author: User
Tags apache error log php error
Why my local environment cannot parse the PHP files under subdirectories
Environment is
apache2.2
PHP5.4


The Htdosc in the Apache installation directory is my Web root directory.
The project I created inside cannot parse the PHP file. The connection is reset! or the network is disconnected. Enter this path in the address bar to see only the files in the current directory.
The root directory index.php can be parsed normally.

Sometimes I'm just fine.
I think there is a problem with the configuration of the httpd.conf. I can't find the reason for it. I'm not very good at Apache configuration.
Please help me with my brother.

------Solution--------------------
httpd.conf resolvable file name extensions:


Typesconfig Conf/mime.types
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
AddType Application/x-httpd-php-source. Phps
AddType application/x-httpd-php. php. phtml. vcgi
AddHandler type-map var

------Solution--------------------
Check the Apache error log and read the newspaper what's wrong.
------Solution--------------------
Htdocs was supposed to put static files.
Dynamic files, such as PHP put in Cgi-bin
Google keywords: Apache scriptalias
------Solution--------------------
PHP Code
DefaultType Text/plain
  
   
    # # Typesconfig points to the ' file containing the list of mappings from # filename extension to Mime-type. # typesconfig Conf/mime.types # # AddType allows you to add to or override the MIME configuration # file Speci    Fied in Typesconfig for specific file types. # #AddType Application/x-gzip tgz # # addencoding allows you to have certain browsers uncompress # Informatio N on the fly.    Note:not all browsers. # #AddEncoding X-compress. Z #AddEncoding x-gzip. gz. tgz # If The addencoding directives above is commented-out, then you # probably Should define those extensions to indicate media types: # AddType application/x-compress.    Z AddType application/x-gzip. gz. tgz addtype application/x-httpd-php. php addtype application/x-httpd-php. php3 # # AddHandler allows to map certain file extensions to ' handlers ': # actions unrelated to filetype. These can either built into the server # or Added with the Action directive (see below) # # to use CGI scripts outside of scriptaliased directories: #    would also need to add "execcgi" to the "Options" directive.) # #AddHandler Cgi-script. CGI # for type maps (negotiated resources): #AddHandler type-map var # # Filters    Allow your to process content before it was sent to the client. # to parse. shtml files for Server-side includes (SSI): # (You'll also need to add "includes" to the "options" D    Irective.) # #AddType text/html shtml #AddOutputFilter includes. shtml
  
------Solution--------------------
The project I created inside cannot parse the PHP file. The connection is reset! or the network is disconnected. Enter this path in the address bar to see only the files in the current directory.
The root directory index.php can be parsed normally.

If you do not have the index.php index file, you open the directory directly, it is true to display the file directory structure, if you have this index.php document, then Apache will parse the index.php document first. This you can modify in Apache config file

Search
Options Indexes FollowSymLinks

Remove indexes and save reboot Apache.

Accessing a file prompts the connection to be reset
Then check the log to see what the specific error is. There may be many reasons for this, such as your PHP error. Open the error prompt in php.ini, set the browser's (ie friendly error hint) ...
  • Related Article

    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.