Magento Manage Categories带有灰色屏幕 - 新安装

I'm using MAMP Pro to drive the servers so I can develop a Magento site locally. I am new to Magento development and ended up starting over because of several errors I coded. I deleted the previous database out, created a new url in MAMP Pro (i.e devmagento.com:8888) which pointed to a new folder I created, dropped the Magento Community edition in the folder, went through the install process, and everything installed perfectly. Right after installation, I tried going to the Manage Categories page and noticed that it loads part of the header until it gets to "Logged in as bassplayer7". After that there is nothing - just grey. All other admin pages work (I haven't tried every single one, but the ones I've tried have).

Other then reindexing and turning the cache off I did not make ANY changes before going to the categories page. No uploads, no config changes, etc.

In troubleshooting the problem, I turned on logging (in Admin>Config) and the Profiler. The logging seems to only log the front end.

I'm at a bit of a loss as to what to look for. I also went into var/cache, and cleared that.

Any help is appreciated!!

One of the first things to do on a fresh Magento development host is to switch on the developer mode.
The reason is, that by default Magento will try to hide all error messages, unless the developer mode is enabled.

How to enable the Developer Mode

There are several ways to accomplish this. The first two options can only be considered quick hacks because they are not upgrade safe. The third option is the right way to do it.

Option 1
In the Magento root directory you will see a file called .htaccess
Put the following code at the top or bottom of that file.

SetEnv MAGE_IS_DEVELOPER_MODE 1

The reload the backend page and hopefully you will see an error message.
Warning: The .htaccess file is part of the Magento core and it will be overwritten during upgrades. Also do not deploy it to a live server with that setting in place.

Option 2
Open the file index.php in the Magento root directory.
Around line 66 you will see the following code:

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

Change that so the developer mode is enabled regardless of the MAGE_IS_DEVELOPER_MODE setting.

if (true || isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

Warning: The index.php file is also part of the Magento core and it will be overwritten during upgrades, just like the .htaccess file. Also do not deploy it to a live server with that setting in place.

Option 3
The right way to enable the developer mode is to place the setting in the apache configuration, e.g. the vhost declaration. I don't know where MAMP Pro keeps them, but for a regular apache on OS X I use the /etc/apache2/extra/httpd-vhosts.conf to configure my development hosts. Here is a sample entry:

<VirtualHost *:80>
    DocumentRoot "/path/to/my/workspace/magento.dev/htdocs"
    ServerName magento.dev
    SetEnv MAGE_IS_DEVELOPER_MODE 1
    ErrorLog "/private/var/log/apache2/magento-error_log"
    CustomLog "/private/var/log/apache2/magento-access_log" common
</VirtualHost>

The benefit of doing it this way is that you can deploy all files unchanged from the development server to the staging server, and from the staging server to the live server.

Further debugging
Once the developer mode is enabled you will hopefully see an error message instead of just a grey screen.
If that doesn't help (still no message), check the Magento log files. They are inside the Magento root directory in the subfolder

  • var/log/exception.log
  • var/log/system.log

Check them for any error messages like "Invalid block class", or "invalid template...".
Still no luck?
Check the Apache or PHP error logs. They are outside of the Magento installation, and the location depends on the system configuration. Maybe PHP error logging still needs to be enabled. Check with MAMP Pro how to do that with that bundle.
The PHP setting in question is log_errors.

Speaking of PHP settings... You will also want to make sure that display_errors is set to On. Otherwise the most hardcore errors (e.g. syntax error that abort compilation) won't be visible, regardless of the developer mode.

Place this in a file called .htaccess in your /magento/ folder

############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

#    Action php5-cgi /cgi-bin/php5-cgi
#    AddHandler php5-cgi .php

############################################
## GoDaddy specific options

#   Options -MultiViews

## you might also need to add this line to php.ini
##     cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

############################################
## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

############################################
## adjust memory limit

#    php_value memory_limit 64M
    php_value memory_limit 256M
    php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    php_flag session.auto_start off

############################################
## enable resulting html compression

    #php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css    text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /magento/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

</IfModule>

############################################
## By default allow all access

    Order allow,deny
    Allow from all

###########################################
## Deny access to release notes to prevent disclosure of the installed Magento version

    <Files RELEASE_NOTES.txt>
        order allow,deny
        deny from all
    </Files>

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none