Сайт localhost пока не может обработать этот запрос http error 500 mamp

HTTP 500 errors in MAMP are typically caused by PHP or .htaccess errors. In this article, learn how to fix HTTP 500 errors in MAMP.

Local testing environments are highly useful tools for WordPress developers and site owners. While we’re partial to DevKinsta, our own free local development tool, MAMP is also an excellent way to set up a WordPress instance. However, it can be hard to do much testing when you can’t access your site, and that’s exactly what a MAMP HTTP Error 500 will result in.

This error is particularly troublesome because it rarely provides any useful information or hints as to the source of the problem. Fortunately, you can usually trace the cause to PHP errors, a corrupt .htaccess file, or problematic WordPress plugins, all of which are relatively easy to fix.

In this article, we’ll explore the causes of this error and walk through three simple troubleshooting steps to get your MAMP installation back on track. Let’s dive in!

An Introduction to the HTTP Error 500

The Hypertext Transfer Protocol (HTTP) 500 Internal Server Error is a message that can sometimes appear when you’re attempting to load a page.

This is a generic, “catch-all” error. Essentially, the server wasn’t able to load the page for one reason or another, but it also couldn’t determine a more specific error code to use:

An HTTP 500 error in Google Chrome.

An HTTP 500 error in Google Chrome.

The error’s presentation can vary based on the specific browser being used, and some websites have custom error pages of their own. So what you’re seeing may not look exactly like the image above, but the basics are the same.

This is a frustrating error, primarily because it’s so vague. If it happens on a MAMP installation it can be even trickier since there are more potential causes.

With WordPress in general, the most common causes of an HTTP 500 error are plugin incompatibilities and a corrupt or missing .htaccess file. This file handles server configuration, so issues there can cause a variety of problems.

Another possible source specific to errors on MAMP comes into play when your site encounters a PHP fatal error. This is often the result of misconfigured files or incorrect code. In these cases, checking the PHP error logs for your installation will often reveal the file that’s causing the issue, as well as the specific problem with the code.

How to Fix the HTTP Error 500 in MAMP

In this section, we’ll walk through troubleshooting each of the potential causes of an Error 500 on a MAMP WordPress installation. You should follow these steps in order, and only proceed to the next fix if the problem persists.

Step 1: Check the PHP Error Log and Resolve Code Problems

The first troubleshooting step you should take is to check your MAMP installation’s PHP error log for problems. This log is a text file with a chronological listing of all PHP errors the installation has encountered and, if they’re PHP code issues, which file they occurred in.

You can find this file in your MAMP logs folder. On Windows, the path is C:MAMPlogs. On a Mac, it’s /Applications/MAMP/logs. Once you’re there, look for the file called php-error:

PHP error log in MAMP.

PHP error log in MAMP.

Open the file and look for any lines that indicate problems. They will begin with “PHP Parse error”. They will also usually tell you exactly what the problem is and which file it’s located in.

The issues you see here may vary. In this example from Stack Overflow, the user had semicolons at the end of some lines in the listed file. These should have been commas instead, and correcting this resolved the error.

If the error log is empty, or if correcting the errors in it doesn’t resolve the “Error 500,” proceed to the next step.

Step 2: Generate a New .htaccess File

Next up, you’ll want to try creating a fresh .htaccess file and see if that resolves the problem. This key WordPress file is located at the root of your website’s folder within the MAMP directory.

On Windows, the default path to your website’s folder is C:MAMPhtdocs. On a Mac, it’s /Applications/MAMP/htdocs.

Once you’re in the folder, locate the .htaccess file:

.htaccess file for Apache configuration.

.htaccess file for Apache configuration.

Rename this file to something like “.htaccess-old”. That will effectively remove it from the equation when WordPress loads. Then try to load your site again. If it works, you know this file was the culprit.

The final step is to generate a fresh .htaccess file. To do that, head to your WordPress dashboard and navigate to Settings > Permalinks:

Save permalink changes in WordPress.

Save permalink changes in WordPress.

Don’t change anything on this page. Instead, simply scroll down and click on Save Changes. This will regenerate the .htaccess file, which is necessary to prevent 404 errors on your pages. At this point, you can safely delete the file you renamed earlier.

Step 3: Deactivate and Test Your Plugins

If neither of the above troubleshooting methods work, the final step to try is disabling all of your site’s plugins. If this fixes the problem, you can enable them one by one until the issue returns. This will tell you which plugin is the culprit, and you can then look for replacements for it or contact its developer for assistance.

If you have access to your WordPress dashboard, you can do this by heading to Plugins > Installed Plugins. Select them all, and then choose Deactivate from the Bulk actions dropdown menu at the top of the screen:

Use Bulk actions to deactivate all plugins on a WordPress site.

Use Bulk actions to deactivate all plugins on a WordPress site.

Once they’re deactivated, attempt to load the problematic page again. If it works, you can now go back to your list of plugins and turn them back on one at a time by clicking on Activate.

After reactivating each individual plugin, refresh your page. If it still loads, move on to reactivating the next one. Continue this process until the error returns, and you’ll know which plugin is causing the error.

If you don’t have access to your WordPress dashboard due to the Error 500, you can deactivate all plugins via the file system. Head back to your website’s directory in MAMP and open the wp-content folder. Inside you’ll find a folder called plugins:

Rename the plugins folder to disable all plugins and restore access.

Rename the plugins folder to disable all plugins and restore access.

Rename this folder to something like “plugins-disabled”, which will effectively deactivate everything inside. You should now have access to your WordPress dashboard.

Go ahead and log in there, and then rename the folder back to “plugins” while the dashboard is still open. They should appear in the Plugins list on your dashboard, and you can proceed to deactivate them all and test them one at a time as outlined above.

Summary

An Error 500 message can bring your WordPress testing to a screeching halt. This error can be frustrating, but it doesn’t have to slow you down. While the message itself is cryptic, the actual culprit is usually easy to find and address.

To troubleshoot and fix an HTTP Error 500 in MAMP, you can try the following steps:

  1. Check MAMP’s error log and resolve any code problems that appear.
  2. Generate a fresh .htaccess file.
  3. Deactivate all of your WordPress plugins and test each one for problems.

If you want to extend the error-free experience to your live site, consider hosting it with Kinsta. Our Application Hosting, Database Hosting, and Managed WordPress hosting plans ensure that your website is always available when your users need it.

And don’t forget to check out DevKinsta as a powerful alternative to MAMP for local testing!


Get all your applications, databases and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

  • Easy setup and management in the MyKinsta dashboard
  • 24/7 expert support
  • The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
  • An enterprise-level Cloudflare integration for speed and security
  • Global audience reach with up to 35 data centers and 275 PoPs worldwide

Test it yourself with $20 off your first month of Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.

The 500 Error is a warning that appears when you try to load a page using the Hypertext Transfer Protocol (HTTP).

Even though all the major WordPress errors are hectic, including 500 Internal Server Error, 504 Gateway Timeout Error, 502 Bad Gateway error, etc. the HTTP Error 500 is especially aggravating as it does not provide any relevant details generally as to the source of the problem.

The appearance of the error varies depending on the browser being used, and some websites have their own specialized error pages. So, while your screen may not look exactly like the one above, the fundamentals remain the same.

HTTP Error 500 Screenshot

This is an annoying error, owing to its ambiguity. It’s considerably difficult if it happens on a MAMP installation because there are more probable causes. In general, plugin incompatibility and a damaged or missing .htaccess file are the most prevalent causes of an HTTP 500 error in WordPress. Because this file is responsible for server setup, errors in it can result in a number of issues.

When your site suffers a PHP fatal error, another probable source of MAMP issues comes into play. This is frequently caused by faulty code or misconfigured files. In these circumstances, looking through your installation’s PHP error logs will usually disclose the file that’s causing the problem, as well as the precise fault with the code.

Fix 1: Turn on the debugging mode of the website.

It is recommended to turn on debugging if WordPress gives you a white screen or a server error. While this might not resolve the error causing the problem, it will surely provide you with more information about what is going on.

You can easily enable the debugging by slightly modifying the wp-config.php file of your site.

Step 1: Look for WP_DEBUG in this file once you’ve accessed it. You should be able to set it to “true” if you discover it. If you don’t see what you’re looking for, you’ll have to make it yourself.

mamp3

Step 2: In any case, you should have a line that looks like this at the end of the day:

define( “WP_DEBUG”, true );

mamp1

Step 3: Reload your site after saving to see if anything has changed.

If you’re lucky, the server error will go away and be replaced by a new message that will tell you exactly where the problem is. If this happens to be the case, investigate the error’s all the sources.

Even if enabling debugging does not yield positive results, it is a good idea to keep it on until the problem is remedied. It will provide you and any developers with a better understanding of what’s going on. Remember to switch off debugging once everything is in order and you’ve completed the maintenance!

Fix 2: Checking the .htaccess file.

If one exists, the .htaccess file contains a set of rules that inform the server what to do in specific situations. It’s widely used to rewrite URLs or block malicious users from accessing your site.

Step 1: Check your WordPress root folder using your FTP editor to see if you have a .htaccess file. Before moving on to this, ensure that your FTP editor lets you see all the hidden files.

mamp5

Step 2: If a .htaccess file exists, make a backup before deleting all of the contents of the entire file. This may eliminate some vital rules, but it will tell you if the error was caused by a file error.

If the error is no longer there, the problem was most likely with the .htaccess file. Attempt to restore the file and then delete sections of it. If the site starts operating again, you’ll know which block the problem is in. Usually, you may condense it to a single line like this. You can then remove that line or seek further advice from your developer or host.

Fix 3: Increasing the memory limit.

Boosting your memory limit can help resolve the error. To do so,

Step 1: look for WP_MEMORY_LIMIT in your wp-config.php file in the WordPress root directory.

Step 2: Change the value to something like “64M” if it exists. If it doesn’t, add the line below to the file:

Define(‘WP_MEMORY_LIMIT’, ‘64M’);

mamp7

If this succeeds, you’ve just temporarily addressed the problem. Most likely, you have a malfunctioning piece of code (which could be a third-party plugin) that is using up all of your resources. Take a look at your resource use with various plugins on/off if your host offers monitoring to get a better understanding of what’s wasting those valuable megabytes.

Fix 4: Deactivating the plugins.

If neither of the preceding troubleshooting approaches works, disable all of your site’s plugins as a last resort. If this resolves the issue, you can activate them one at a time until the problem reappears. This will reveal which plugin is to blame, allowing you to search for alternatives or contact the plugin’s developer for help.

If you can access your WordPress dashboard,

Step 1: Go to Plugins and click on Installed Plugins to do so.

Step 2: Choose Deactivate from the Bulk actions dropdown menu at the top of the screen after selecting them all or deactivate them individually and check the website status.

HTTP Error 500: Plugins

Step 3: Reload the problematic page after they’ve been deactivated.

Step 4: If it works, go back to your plugin list and click on Activate to turn each one back on one at a time.

Refresh your page after reactivating each plugin individually. If it still loads, go to the next one and reactivate it. Repeat this method until the error reappears, and you’ll know which plugin is to blame.

You can deactivate all plugins via the file system if you can’t access your WordPress dashboard due to Error 500.

Step 1: Return to MAMP and open the wp-content folder in your website’s directory. Inside, you’ll see a plugins folder.

Step 2: Rename this folder to something like “plugins-disabled,” and everything inside will be turned off. Your WordPress dashboard should now be accessible.

HTTP Error 500: FTP connection

Step 3: Log in there first, then rename the folder back to “plugins” while the dashboard is still open.

They should display in your dashboard’s Plugins section, where you can disable them all and test them one at a time.

Fix 5: Asking your web host provider

There are a few odd difficulties that can cause WordPress errors, but at this point, it’s probably better to contact your host. They can look into things like file permissions and other sources to see if the problem is a genuine server issue, which they can at least confirm.

Alternatively, you might simply choose to upgrade to a better host with WordPress-optimized servers. It isn’t necessary to spend a lot of money on this. For a low amount per month, you can get an adequate WordPress experience from the best web host providers.

Fix 6: Reinstalling WordPress again.

There are a few exceptions where a WordPress reinstall may help. Along the process, it might even fix file permission issues. It is recommended to follow the manual WordPress backup and setup instructions.

Conclusion

WordPress testing might be brought to a halt by an Error 500 notice. Although this issue is inconvenient, it does not have to slow you down. While the message may be enigmatic, the actual perpetrator is usually easy to track down and deal with. Also, following the above-mentioned steps and fixes will surely help you resolve the error.

I just joined stackoverflow yesterday so I do not have enough reputation to comment. I write an answer here.

here is the short answer:

run :

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile
source ~/.bash_profile

check your php version by running php -v. close the terminal. Open another terminal and check php version again.if you see php 5 again then there are 2 possibilities:
First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first.
Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.

This is the long answer for anyone else:

first of all, if you are on mac, I highly suggest you to use valet to get rid of all these things.

But regarding the problem:

As you already noted that it is not a laravel issue. the php version that your machine uses is under the min required version by laravel. You have 2 versions of php at the moment. MacOs is shipped with php installed on that. I think it is the same php 5.5.36 that is making problem for you. Since Laravel 5.4, you need to use PHP >= 5.6.4.
Although you have installed parallel php 7 on your machine, you need also to check which php your machine is reading from by running which php. after that remember to add your path to php 7 installed to bash_profile or other bash files on your mac(you can have 4 or 5 bash files).
Considering you have only one bash file named as bash_profile and you are going to export the path to your php 7 to bash profile, If you run following command, that appends the path to the end of file

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile

remember to use source ~/.bash_profile in order to make changes effected.
Alternatively you can open the bash_profile file in your text editor by running:

open -a /Applications/TextEdit.app ~/.bash_profile

and add the path manually before the /path/to/php5 path.

finally you must check your php version by running php -v.
close the terminal. Open another terminal and check php version again. If you see php 7 then you are all fine. But if you see php 5 again then there are 2 possibilities:
First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first.
Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.

Есть страница form_register.php, если писать в ней просто текст, то на неё спокойно переходит. Если будет такая разметка с тегами php, то тоже перейдёт.

<?php
    require_once 'database.php';
    require_once 'top_header.php';
?>

    <div class="description">
        <div class="col-md-12">
            Привет
        </div>
    </div>
    </div>

<?php 
    require_once 'bottom_header.php'; 
    require_once 'footer.php';
?>

Но если я пишу вместе с сессиями:

<?php
    require_once 'database.php';
    require_once 'top_header.php';
?>

    <div class="description">
        <div class="col-md-12">


            <!-- Блок для вывода сообщений -->
            <div class="block_for_messages">
                <?php
        //Если в сессии существуют сообщения об ошибках, то выводим их
        if(isset($_SESSION["error_messages"]) && !empty($_SESSION["error_messages"])){
            echo $_SESSION["error_messages"];

            //Уничтожаем чтобы не выводились заново при обновлении страницы
            unset($_SESSION["error_messages"]);
        }

        //Если в сессии существуют радостные сообщения, то выводим их
        if(isset($_SESSION["success_messages"]) && !empty($_SESSION["success_messages"])){
            echo $_SESSION["success_messages"];
            
            //Уничтожаем чтобы не выводились заново при обновлении страницы
            unset($_SESSION["success_messages"]);
        }
    ?>
            </div>

            <?php 
    //Проверяем, если пользователь не авторизован, то выводим форму регистрации, 
    //иначе выводим сообщение о том, что он уже зарегистрирован
    if(!isset($_SESSION["email"]) && !isset($_SESSION["password"])){
?>
            <div id="form_register">
                <h2>Форма регистрации</h2>

                <form action="register.php" method="post" name="form_register">
                    <table>
                        <tr>
                            <td> Имя: </td>
                            <td>
                                <input type="text" name="first_name" required="required" />
                            </td>
                        </tr>

                        <tr>
                            <td> Фамилия: </td>
                            <td>
                                <input type="text" name="last_name" required="required" />
                            </td>
                        </tr>

                        <tr>
                            <td> Email: </td>
                            <td>
                                <input type="email" name="email" required="required" /><br />
                                <span id="valid_email_message" class="mesage_error"></span>
                            </td>
                        </tr>

                        <tr>
                            <td> Пароль: </td>
                            <td>
                                <input type="password" name="password" placeholder="минимум 6 символов" required="required" /><br />
                                <span id="valid_password_message" class="mesage_error"></span>
                            </td>
                        </tr>
                        <tr>
                            <td> Введите капчу: </td>
                            <td>
                                <p>
                                    <img src="captcha.php" alt="Капча" /> <br />
                                    <input type="text" name="captcha" placeholder="Проверочный код" required="required" />
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <input type="submit" name="btn_submit_register" value="Зарегистрироватся!" />
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
            <?php 
    }else{
?>
            <div id="authorized">
                <h2>Вы уже зарегистрированы</h2>
            </div>
        </div>
    </div>
    </div>

<?php 
    require_once 'bottom_header.php'; 
    require_once 'footer.php';
?>

Выводит ошибку
d48fd047219e44f6aeadc5df7ae4f616.pngСессию подключаю в файле top_header.php
759882404667477980d90060f8b80127.png

Из-за чего возникает ошибка?

What I have done:
Apache Port set to 9000
Location of wordpress folder is C:MAMPhtdocs.
Folder is called wordpress
Went to phpMyAdmin and created DB
Went to wp-config-sample.php and updated DB = wpTest, username & password = ‘root’
changed wp-config-sample.php to wp-config.php
Servers are started.

What displays in chrome browser OK:

http://localhost:9000/MAMP/
http://localhost:9000/wordpress/readme.html

http://localhost:9000/wordpress/ gives the error in browser:

This page isn’t working 
localhost is currently unable to handle this request.
HTTP ERROR 500

I am therefore unable to set up wordpress.

One thing I have noticed is that MAMP and htdocs folder properties when read only is unchecked and applied and I open it again then read only is checked again.
I have given all users full control in security settings.

Thanks

asked Jul 2, 2017 at 2:59

maggs's user avatar

maggsmaggs

1251 silver badge13 bronze badges

5

the unzipping program I used to extract the wordpress files did not unzip correctly and the files within the folders wp-admin, wp-content, wp-includes were displayed but not the folders themselves. Several times I downloaded & unzipped the wordpress files and all with the same results.
I changed the unzipping programming and the folders were correctly unzipped.
In the past I have had an unzipping program fail to extract a file but never extract the files incorrectly like this before.

Initially without the folders the path to load certain files was incorrect and they couldn’t be found and hence the error:

This page isn’t working 
localhost is currently unable to handle this request.
HTTP ERROR 500    

answered Jul 4, 2017 at 12:28

maggs's user avatar

maggsmaggs

1251 silver badge13 bronze badges

What I have done:
Apache Port set to 9000
Location of wordpress folder is C:MAMPhtdocs.
Folder is called wordpress
Went to phpMyAdmin and created DB
Went to wp-config-sample.php and updated DB = wpTest, username & password = ‘root’
changed wp-config-sample.php to wp-config.php
Servers are started.

What displays in chrome browser OK:

http://localhost:9000/MAMP/
http://localhost:9000/wordpress/readme.html

http://localhost:9000/wordpress/ gives the error in browser:

This page isn’t working 
localhost is currently unable to handle this request.
HTTP ERROR 500

I am therefore unable to set up wordpress.

One thing I have noticed is that MAMP and htdocs folder properties when read only is unchecked and applied and I open it again then read only is checked again.
I have given all users full control in security settings.

Thanks

asked Jul 2, 2017 at 2:59

maggs's user avatar

maggsmaggs

1251 silver badge13 bronze badges

5

the unzipping program I used to extract the wordpress files did not unzip correctly and the files within the folders wp-admin, wp-content, wp-includes were displayed but not the folders themselves. Several times I downloaded & unzipped the wordpress files and all with the same results.
I changed the unzipping programming and the folders were correctly unzipped.
In the past I have had an unzipping program fail to extract a file but never extract the files incorrectly like this before.

Initially without the folders the path to load certain files was incorrect and they couldn’t be found and hence the error:

This page isn’t working 
localhost is currently unable to handle this request.
HTTP ERROR 500    

answered Jul 4, 2017 at 12:28

maggs's user avatar

maggsmaggs

1251 silver badge13 bronze badges

Понравилась статья? Поделить с друзьями:
  • Сайт localhost пока не может обработать этот запрос http error 500 exchange
  • Сайт lkip2 nalog ru пока не может обработать этот запрос http error 500
  • Сайт bit ly не позволяет установить соединение как исправить
  • Сайт animego org пока не может обработать этот запрос http error 500
  • Саи программа обнаружила ошибку исключения