Why my local environment cannot parse the PHP files under subdirectories

Source: Internet
Author: User
Tags apache error log php error
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.


Reply to discussion (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

httpd.conf resolvable file name extensions:


Typesconfig Conf/mime.types
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
Add ...

You have two of these in my configuration. I added a reboot. It's not a problem.

What system do you have?

Win7

Early on, I was above the Linux Apache configuration file, you see this is not the same as you:
wamp-windows_apache_mysql_php related configuration and construction environment

Oh, no. General configuration I know that.
The. php file of the root directory can be parsed. The subdirectory cannot be parsed. If the subdirectory does not have index.php then the browser lists the files under all subdirectories. If there is this index.php, the browser prompts the connection to be reset and the connection is disconnected.

No, the httpd.conf file that you modified according to the # # document does not appear to be a problem. Did you write a repetition? Or not write the specification? Compare it with the installed httpd.conf.

Check the Apache error log and read the newspaper what's wrong.

Htdocs was supposed to put static files.
Dynamic files, such as PHP put in Cgi-bin
Google keywords: Apache scriptalias

I am win7 under the WAMP environment, run OK, if necessary, leave a mail, I sent to you.

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
 

Htdocs was supposed to put static files.
Dynamic files, such as PHP put in Cgi-bin
Google keywords: Apache scriptalias

It's okay with what 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.

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

Thank you for your answer. Although I have not found the reason, but also learned a lot of things.
It was settled later.
The solution is simple. I downloaded another Apache again. After installing the configuration, everything is fine.

I've had this problem, too.

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