WordPress

XAMPP Apache Won't Start / How to Fix the Port 80 Error?

The Problem: Why Won't Apache Start?

When you press the Start button next to Apache in the XAMPP Control Panel, if the row turns green for a moment and then immediately goes back to red, and you see a message like the following in the log, you have a port conflict:

Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...

The reason is straightforward: by default Apache wants to use port 80 for web traffic. If another program on your computer is already using this port, Apache cannot start. In some cases, port 443 used for SSL causes the same problem.

Which Programs Use Port 80?

The most common culprits are: Skype (older versions may use 80 and 443), IIS (Windows' own web server), VMware, various antivirus/security software, and sometimes the Windows service called World Wide Web Publishing Service. The solution is twofold: either you stop the program using the port, or you redirect Apache to a different port.

Solution 1: Find and Stop the Program Using the Port

Step 1: Which Program Is Using It?

Click the Netstat button on the right side of the XAMPP Control Panel. This shows which program is using port 80. Alternatively, you can open Command Prompt as administrator and run the following command:

netstat -ano | findstr :80

Using the PID (process ID) at the end of the line that appears, you can find the program in the "Details" tab of Task Manager.

Step 2: Stop the Program

If the problem is Skype: go to "Connection" in Skype settings, uncheck "Use port 80 and 443 for incoming connections", and restart Skype.

If the problem is IIS: you can disable "Internet Information Services" via Control Panel > Programs > Turn Windows features on or off, or you can stop the "World Wide Web Publishing Service" through services (services.msc).

Solution 2: Move Apache to a Different Port (Recommended Permanent Fix)

If you can't close the program using the port, moving Apache from 80 to port 8080 is the cleanest solution.

Step 1: Open the httpd.conf File

Click the Config button on the Apache row in the XAMPP Control Panel and select the httpd.conf file.

Step 2: Change the Port Number

Find the Listen 80 line in the file and change it to Listen 8080. Also change the ServerName localhost:80 line just below it to ServerName localhost:8080.

Listen 8080
ServerName localhost:8080

Step 3: Change the SSL Port (If Needed)

If port 443 is also conflicting, open the httpd-ssl.conf file from the Config menu on the Apache row and change the Listen 443 line to Listen 4433.

Step 4: Save and Restart

Save the files and Start Apache in XAMPP. You will now access the site at http://localhost:8080. If you have a WordPress site installed locally, you may need to update its address accordingly.

Solution 3: Run as Administrator

Sometimes the problem isn't the port but permissions. Close the XAMPP Control Panel, right-click its icon, and try reopening it with "Run as administrator". This can resolve permission-related startup issues.

If MySQL Won't Start Either

If you are experiencing the same issue with MySQL, port 3306 is usually conflicting (for example, you may have a separate MySQL installed on the computer) or the database files are corrupted. You can check for a port conflict with the netstat method above, and in case of file corruption you can restore from the backups in XAMPP's mysql/data folder.

Finding the Problem by Reading the Error Logs

When Apache won't start, instead of guessing, reading the logs XAMPP provides is the most accurate approach. In the XAMPP Control Panel, click the Logs button next to the Apache row and open the "Apache (error.log)" file. The last lines at the bottom of the file clearly state why startup failed. For port conflicts, you usually see phrases like "make_sock: could not bind to address" or "Address already in use". If there is a configuration error, the file and line where the error occurred are also stated here. Reading the log reveals the real source of the problem within minutes.

Beware of Configuration File Corruption

Sometimes the reason Apache won't start is not the port but a faulty edit made in httpd.conf or related configuration files. If Apache stopped starting after you made manual changes to the file, you most likely made a typo (a missing quote, a wrong path, an unclosed block). For this reason, always make a backup before changing such files; if a problem occurs you can easily revert to the previous state. The error.log file usually clearly states which line the error is on, so you can quickly find and fix the wrong edit.

Frequently Asked Questions (FAQ)

If I move Apache to port 8080, how do I access my sites?

After the port change, you access your sites at http://localhost:8080. Just adding :8080 to the end of the address is enough. If you have a WordPress site installed locally, you may need to update the site address (siteurl and home) according to the new port as well.

How do I find which program is using port 80?

You can use the Netstat button in the XAMPP Control Panel or run the netstat -ano | findstr :80 command in an administrator Command Prompt. With the PID number at the end of the resulting line, you find the program in the Details tab of Task Manager.

Why does Skype block Apache?

Some versions of Skype use ports 80 and 443 for incoming connections. This conflicts with Apache. You can solve the problem by unchecking this option in the Connection section of Skype settings and restarting Skype.

Conclusion

Apache failing to start in XAMPP is almost always caused by a port conflict. First, identify the program using the port by reading the error.log file and the netstat output; then either stop that program or move Apache to a free port such as 8080. With these steps you can solve the problem in a few minutes and continue developing from where you left off.

Related Articles

WordPress

XAMPP Apache startet nicht / Wie behebt man den Port-80-Fehler?

Das Problem: Warum startet Apache nicht?

Wenn Sie im XAMPP-Kontrollpanel auf die Schaltfläche „Start“ neben Apache klicken und die Zeile kurz grün wird, dann aber sofort wieder rot, und Sie im Protokoll eine Meldung wie die folgende sehen, liegt ein Portkonflikt vor:

Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...

Der Grund ist einfach: Apache möchte standardmäßig Port 80 für den Webverkehr verwenden. Wenn ein anderes Programm auf Ihrem Computer diesen Port bereits belegt, kann Apache nicht starten. In manchen Fällen verursacht der für SSL verwendete Port 443 dasselbe Problem.

Welche Programme belegen Port 80?

Die häufigsten Übeltäter sind: Skype (ältere Versionen können 80 und 443 verwenden), IIS (der eigene Webserver von Windows), VMware, verschiedene Antiviren-/Sicherheitsprogramme und manchmal der Windows-Dienst namens World Wide Web Publishing Service. Es gibt zwei Lösungswege: Entweder Sie beenden das Programm, das den Port belegt, oder Sie leiten Apache auf einen anderen Port um.

Lösung 1: Das Programm finden und beenden, das den Port belegt

Schritt 1: Welches Programm belegt ihn?

Klicken Sie auf die Schaltfläche „Netstat“ auf der rechten Seite des XAMPP-Kontrollpanels. Diese zeigt an, welches Programm Port 80 belegt. Alternativ können Sie die Eingabeaufforderung als Administrator öffnen und den folgenden Befehl ausführen:

netstat -ano | findstr :80

Mit der PID (Prozess-ID) am Ende der angezeigten Zeile können Sie das Programm im Reiter „Details“ des Task-Managers finden.

Schritt 2: Das Programm beenden

Wenn das Problem Skype ist: Gehen Sie in den Skype-Einstellungen zu „Verbindung“, deaktivieren Sie „Port 80 und 443 für eingehende Verbindungen verwenden“ und starten Sie Skype neu.

Wenn das Problem IIS ist: Sie können „Internet Information Services“ über Systemsteuerung > Programme > Windows-Features aktivieren oder deaktivieren abschalten, oder Sie können den Dienst „World Wide Web Publishing Service“ über die Dienste (services.msc) beenden.

Lösung 2: Apache auf einen anderen Port verschieben (empfohlene dauerhafte Lösung)

Wenn Sie das Programm, das den Port belegt, nicht schließen können, ist das Verschieben von Apache von Port 80 auf Port 8080 die sauberste Lösung.

Schritt 1: Die Datei httpd.conf öffnen

Klicken Sie im XAMPP-Kontrollpanel in der Apache-Zeile auf die Schaltfläche „Config“ und wählen Sie die Datei httpd.conf aus.

Schritt 2: Die Portnummer ändern

Suchen Sie in der Datei die Zeile Listen 80 und ändern Sie sie in Listen 8080. Ändern Sie auch die direkt darunter stehende Zeile ServerName localhost:80 in ServerName localhost:8080.

Listen 8080
ServerName localhost:8080

Schritt 3: Den SSL-Port ändern (falls nötig)

Wenn auch Port 443 in Konflikt steht, öffnen Sie über das Config-Menü in der Apache-Zeile die Datei httpd-ssl.conf und ändern Sie die Zeile Listen 443 in Listen 4433.

Schritt 4: Speichern und neu starten

Speichern Sie die Dateien und starten Sie Apache in XAMPP. Sie greifen nun unter http://localhost:8080 auf die Website zu. Wenn Sie eine lokal installierte WordPress-Website haben, müssen Sie deren Adresse möglicherweise entsprechend aktualisieren.

Lösung 3: Als Administrator ausführen

Manchmal ist nicht der Port das Problem, sondern die Berechtigungen. Schließen Sie das XAMPP-Kontrollpanel, klicken Sie mit der rechten Maustaste auf sein Symbol und versuchen Sie, es mit „Als Administrator ausführen“ erneut zu öffnen. Dies kann berechtigungsbedingte Startprobleme lösen.

Wenn auch MySQL nicht startet

Wenn Sie dasselbe Problem mit MySQL haben, steht meist Port 3306 in Konflikt (zum Beispiel kann ein separates MySQL auf dem Computer installiert sein) oder die Datenbankdateien sind beschädigt. Einen Portkonflikt können Sie mit der obigen netstat-Methode prüfen, und im Falle einer Dateibeschädigung können Sie aus den Sicherungen im Ordner mysql/data von XAMPP wiederherstellen.

Das Problem durch Lesen der Fehlerprotokolle finden

Wenn Apache nicht startet, ist das Lesen der von XAMPP bereitgestellten Protokolle der zuverlässigste Weg, statt zu raten. Klicken Sie im XAMPP-Kontrollpanel neben der Apache-Zeile auf die Schaltfläche „Logs“ und öffnen Sie die Datei „Apache (error.log)“. Die letzten Zeilen am Ende der Datei geben klar an, warum der Start fehlgeschlagen ist. Bei Portkonflikten sehen Sie in der Regel Formulierungen wie „make_sock: could not bind to address“ oder „Address already in use“. Liegt ein Konfigurationsfehler vor, wird hier auch angegeben, in welcher Datei und in welcher Zeile der Fehler aufgetreten ist. Das Lesen des Protokolls deckt die tatsächliche Ursache des Problems innerhalb von Minuten auf.

Vorsicht vor Beschädigung der Konfigurationsdatei

Manchmal liegt der Grund, warum Apache nicht startet, nicht am Port, sondern an einer fehlerhaften Änderung in der httpd.conf oder den zugehörigen Konfigurationsdateien. Wenn Apache nicht mehr startet, nachdem Sie manuelle Änderungen an der Datei vorgenommen haben, haben Sie höchstwahrscheinlich einen Tippfehler gemacht (ein fehlendes Anführungszeichen, einen falschen Pfad, einen nicht geschlossenen Block). Erstellen Sie deshalb immer eine Sicherung, bevor Sie solche Dateien ändern; bei einem Problem können Sie leicht zum vorherigen Zustand zurückkehren. Die Datei error.log gibt in der Regel klar an, in welcher Zeile sich der Fehler befindet, sodass Sie die falsche Änderung schnell finden und beheben können.

Häufig gestellte Fragen (FAQ)

Wie greife ich auf meine Websites zu, wenn ich Apache auf Port 8080 verschiebe?

Nach der Portänderung greifen Sie unter http://localhost:8080 auf Ihre Websites zu. Es genügt, am Ende der Adresse :8080 hinzuzufügen. Wenn Sie eine lokal installierte WordPress-Website haben, müssen Sie möglicherweise auch die Website-Adresse (siteurl und home) entsprechend dem neuen Port aktualisieren.

Wie finde ich heraus, welches Programm Port 80 belegt?

Sie können die Schaltfläche „Netstat“ im XAMPP-Kontrollpanel verwenden oder in einer Administrator-Eingabeaufforderung den Befehl netstat -ano | findstr :80 ausführen. Mit der PID-Nummer am Ende der resultierenden Zeile finden Sie das Programm im Reiter „Details“ des Task-Managers.

Warum blockiert Skype Apache?

Einige Versionen von Skype verwenden die Ports 80 und 443 für eingehende Verbindungen. Dies steht in Konflikt mit Apache. Sie können das Problem lösen, indem Sie diese Option im Abschnitt „Verbindung“ der Skype-Einstellungen deaktivieren und Skype neu starten.

Fazit

Dass Apache in XAMPP nicht startet, wird fast immer durch einen Portkonflikt verursacht. Ermitteln Sie zunächst durch Lesen der Datei error.log und der netstat-Ausgabe das Programm, das den Port belegt; beenden Sie dann entweder dieses Programm oder verschieben Sie Apache auf einen freien Port wie 8080. Mit diesen Schritten können Sie das Problem in wenigen Minuten lösen und dort weiterentwickeln, wo Sie aufgehört haben.

Verwandte Artikel

WordPress

Apache XAMPP ne démarre pas / Comment résoudre l'erreur du port 80 ?

Le problème : pourquoi Apache ne démarre-t-il pas ?

Lorsque vous cliquez sur le bouton Start à côté d'Apache dans le panneau de contrôle XAMPP, si la ligne devient verte un instant puis repasse immédiatement au rouge, et que vous voyez dans le journal un message semblable au suivant, vous êtes confronté à un conflit de port :

Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...

La raison est simple : par défaut, Apache souhaite utiliser le port 80 pour le trafic web. Si un autre programme sur votre ordinateur utilise déjà ce port, Apache ne peut pas démarrer. Dans certains cas, le port 443 utilisé pour le SSL provoque le même problème.

Quels programmes utilisent le port 80 ?

Les coupables les plus fréquents sont : Skype (les anciennes versions peuvent utiliser 80 et 443), IIS (le serveur web propre à Windows), VMware, divers logiciels antivirus/de sécurité et parfois le service Windows nommé World Wide Web Publishing Service. La solution est double : soit vous arrêtez le programme qui utilise le port, soit vous redirigez Apache vers un autre port.

Solution 1 : trouver et arrêter le programme qui utilise le port

Étape 1 : quel programme l'utilise ?

Cliquez sur le bouton Netstat situé à droite du panneau de contrôle XAMPP. Celui-ci indique quel programme utilise le port 80. Vous pouvez aussi ouvrir l'invite de commandes en tant qu'administrateur et exécuter la commande suivante :

netstat -ano | findstr :80

Grâce au PID (identifiant de processus) situé à la fin de la ligne affichée, vous pouvez trouver le programme dans l'onglet « Détails » du Gestionnaire des tâches.

Étape 2 : arrêter le programme

Si le problème vient de Skype : allez dans « Connexion » dans les paramètres de Skype, décochez « Utiliser les ports 80 et 443 pour les connexions entrantes », puis redémarrez Skype.

Si le problème vient d'IIS : vous pouvez désactiver « Internet Information Services » via Panneau de configuration > Programmes > Activer ou désactiver des fonctionnalités Windows, ou vous pouvez arrêter le service « World Wide Web Publishing Service » via les services (services.msc).

Solution 2 : déplacer Apache vers un autre port (solution permanente recommandée)

Si vous ne pouvez pas fermer le programme qui utilise le port, déplacer Apache du port 80 vers le port 8080 est la solution la plus propre.

Étape 1 : ouvrir le fichier httpd.conf

Dans le panneau de contrôle XAMPP, cliquez sur le bouton Config de la ligne Apache et sélectionnez le fichier httpd.conf.

Étape 2 : modifier le numéro de port

Trouvez la ligne Listen 80 dans le fichier et remplacez-la par Listen 8080. Modifiez également la ligne ServerName localhost:80 située juste en dessous en ServerName localhost:8080.

Listen 8080
ServerName localhost:8080

Étape 3 : modifier le port SSL (si nécessaire)

Si le port 443 entre lui aussi en conflit, ouvrez le fichier httpd-ssl.conf depuis le menu Config de la ligne Apache et remplacez la ligne Listen 443 par Listen 4433.

Étape 4 : enregistrer et redémarrer

Enregistrez les fichiers et démarrez (Start) Apache dans XAMPP. Vous accéderez désormais au site à l'adresse http://localhost:8080. Si vous avez un site WordPress installé en local, vous devrez peut-être mettre à jour son adresse en conséquence.

Solution 3 : exécuter en tant qu'administrateur

Parfois, le problème ne vient pas du port mais des autorisations. Fermez le panneau de contrôle XAMPP, faites un clic droit sur son icône et essayez de le rouvrir avec « Exécuter en tant qu'administrateur ». Cela peut résoudre les problèmes de démarrage liés aux autorisations.

Si MySQL ne démarre pas non plus

Si vous rencontrez le même problème avec MySQL, c'est généralement le port 3306 qui entre en conflit (par exemple, un MySQL distinct peut être installé sur l'ordinateur) ou les fichiers de la base de données sont corrompus. Vous pouvez vérifier un conflit de port avec la méthode netstat ci-dessus, et en cas de corruption de fichiers, vous pouvez restaurer à partir des sauvegardes situées dans le dossier mysql/data de XAMPP.

Trouver le problème en lisant les journaux d'erreurs

Lorsqu'Apache ne démarre pas, plutôt que de deviner, lire les journaux fournis par XAMPP est l'approche la plus fiable. Dans le panneau de contrôle XAMPP, cliquez sur le bouton Logs à côté de la ligne Apache et ouvrez le fichier « Apache (error.log) ». Les dernières lignes en bas du fichier indiquent clairement pourquoi le démarrage a échoué. Pour les conflits de port, vous voyez généralement des expressions telles que « make_sock: could not bind to address » ou « Address already in use ». S'il y a une erreur de configuration, le fichier et la ligne où l'erreur s'est produite sont également indiqués ici. La lecture du journal révèle la véritable source du problème en quelques minutes.

Attention à la corruption du fichier de configuration

Parfois, la raison pour laquelle Apache ne démarre pas n'est pas le port, mais une modification erronée effectuée dans httpd.conf ou les fichiers de configuration associés. Si Apache a cessé de démarrer après que vous avez apporté des modifications manuelles au fichier, vous avez très probablement fait une faute de frappe (un guillemet manquant, un mauvais chemin, un bloc non fermé). C'est pourquoi vous devez toujours faire une sauvegarde avant de modifier de tels fichiers ; en cas de problème, vous pouvez facilement revenir à l'état précédent. Le fichier error.log indique généralement clairement à quelle ligne se trouve l'erreur, ce qui vous permet de trouver et de corriger rapidement la modification erronée.

Foire aux questions (FAQ)

Si je déplace Apache vers le port 8080, comment accéder à mes sites ?

Après le changement de port, vous accédez à vos sites à l'adresse http://localhost:8080. Il suffit d'ajouter :8080 à la fin de l'adresse. Si vous avez un site WordPress installé en local, vous devrez peut-être également mettre à jour l'adresse du site (siteurl et home) en fonction du nouveau port.

Comment savoir quel programme utilise le port 80 ?

Vous pouvez utiliser le bouton Netstat dans le panneau de contrôle XAMPP ou exécuter la commande netstat -ano | findstr :80 dans une invite de commandes administrateur. Grâce au numéro de PID situé à la fin de la ligne obtenue, vous trouvez le programme dans l'onglet Détails du Gestionnaire des tâches.

Pourquoi Skype bloque-t-il Apache ?

Certaines versions de Skype utilisent les ports 80 et 443 pour les connexions entrantes. Cela entre en conflit avec Apache. Vous pouvez résoudre le problème en décochant cette option dans la section Connexion des paramètres de Skype et en redémarrant Skype.

Conclusion

Le fait qu'Apache ne démarre pas dans XAMPP est presque toujours dû à un conflit de port. Identifiez d'abord le programme qui utilise le port en lisant le fichier error.log et la sortie de netstat ; ensuite, arrêtez ce programme ou déplacez Apache vers un port libre tel que 8080. Avec ces étapes, vous pouvez résoudre le problème en quelques minutes et reprendre votre développement là où vous l'aviez laissé.

Articles connexes

WordPress

Apache XAMPP non si avvia / Come risolvere l'errore della porta 80?

Il problema: perché Apache non si avvia?

Quando nel Pannello di controllo XAMPP preme il pulsante Start accanto ad Apache, se la riga diventa verde per un istante e poi torna immediatamente rossa, e vede nel log un messaggio simile al seguente, si trova di fronte a un conflitto di porta:

Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...

Il motivo è semplice: per impostazione predefinita Apache vuole utilizzare la porta 80 per il traffico web. Se un altro programma sul Suo computer sta già utilizzando questa porta, Apache non può avviarsi. In alcuni casi, la porta 443 utilizzata per l'SSL causa lo stesso problema.

Quali programmi utilizzano la porta 80?

I colpevoli più frequenti sono: Skype (le versioni più vecchie possono utilizzare 80 e 443), IIS (il server web proprio di Windows), VMware, vari software antivirus/di sicurezza e talvolta il servizio Windows chiamato World Wide Web Publishing Service. La soluzione è duplice: o ferma il programma che utilizza la porta, oppure reindirizza Apache su un'altra porta.

Soluzione 1: trovare e fermare il programma che utilizza la porta

Passo 1: quale programma la sta utilizzando?

Clicchi sul pulsante Netstat sul lato destro del Pannello di controllo XAMPP. Questo mostra quale programma sta utilizzando la porta 80. In alternativa, può aprire il Prompt dei comandi come amministratore ed eseguire il seguente comando:

netstat -ano | findstr :80

Utilizzando il PID (ID del processo) alla fine della riga visualizzata, può trovare il programma nella scheda "Dettagli" di Gestione attività.

Passo 2: fermare il programma

Se il problema è Skype: vada su "Connessione" nelle impostazioni di Skype, deselezioni "Usa le porte 80 e 443 per le connessioni in entrata" e riavvii Skype.

Se il problema è IIS: può disattivare "Internet Information Services" tramite Pannello di controllo > Programmi > Attiva o disattiva le funzionalità di Windows, oppure può fermare il servizio "World Wide Web Publishing Service" tramite i servizi (services.msc).

Soluzione 2: spostare Apache su un'altra porta (soluzione permanente consigliata)

Se non riesce a chiudere il programma che utilizza la porta, spostare Apache dalla 80 alla porta 8080 è la soluzione più pulita.

Passo 1: aprire il file httpd.conf

Nel Pannello di controllo XAMPP clicchi sul pulsante Config nella riga di Apache e selezioni il file httpd.conf.

Passo 2: modificare il numero di porta

Trovi nel file la riga Listen 80 e la cambi in Listen 8080. Modifichi anche la riga ServerName localhost:80 subito sotto in ServerName localhost:8080.

Listen 8080
ServerName localhost:8080

Passo 3: modificare la porta SSL (se necessario)

Se anche la porta 443 è in conflitto, apra il file httpd-ssl.conf dal menu Config nella riga di Apache e cambi la riga Listen 443 in Listen 4433.

Passo 4: salvare e riavviare

Salvi i file e avvii (Start) Apache in XAMPP. Ora accederà al sito all'indirizzo http://localhost:8080. Se ha un sito WordPress installato in locale, potrebbe dover aggiornare il suo indirizzo di conseguenza.

Soluzione 3: eseguire come amministratore

A volte il problema non è la porta ma le autorizzazioni. Chiuda il Pannello di controllo XAMPP, faccia clic con il tasto destro sulla sua icona e provi a riaprirlo con "Esegui come amministratore". Questo può risolvere i problemi di avvio legati alle autorizzazioni.

Se anche MySQL non si avvia

Se sta riscontrando lo stesso problema con MySQL, di solito è la porta 3306 a essere in conflitto (ad esempio, potrebbe avere un MySQL separato installato sul computer) o i file del database sono danneggiati. Può verificare un conflitto di porta con il metodo netstat sopra indicato e, in caso di danneggiamento dei file, può ripristinare dai backup presenti nella cartella mysql/data di XAMPP.

Trovare il problema leggendo i log degli errori

Quando Apache non si avvia, invece di tirare a indovinare, leggere i log forniti da XAMPP è l'approccio più affidabile. Nel Pannello di controllo XAMPP clicchi sul pulsante Logs accanto alla riga di Apache e apra il file "Apache (error.log)". Le ultime righe in fondo al file indicano chiaramente perché l'avvio è fallito. Per i conflitti di porta, di solito vede espressioni come "make_sock: could not bind to address" o "Address already in use". In caso di errore di configurazione, anche il file e la riga in cui si è verificato l'errore vengono indicati qui. Leggere il log rivela la vera origine del problema in pochi minuti.

Attenzione al danneggiamento del file di configurazione

A volte il motivo per cui Apache non si avvia non è la porta, ma una modifica errata effettuata in httpd.conf o nei file di configurazione correlati. Se Apache ha smesso di avviarsi dopo che ha apportato modifiche manuali al file, molto probabilmente ha commesso un errore di battitura (un apice mancante, un percorso sbagliato, un blocco non chiuso). Per questo motivo, esegua sempre un backup prima di modificare tali file; in caso di problemi potrà tornare facilmente allo stato precedente. Il file error.log indica solitamente in modo chiaro su quale riga si trova l'errore, in modo da poter trovare e correggere rapidamente la modifica errata.

Domande frequenti (FAQ)

Se sposto Apache sulla porta 8080, come accedo ai miei siti?

Dopo il cambio di porta, accederà ai Suoi siti all'indirizzo http://localhost:8080. È sufficiente aggiungere :8080 alla fine dell'indirizzo. Se ha un sito WordPress installato in locale, potrebbe dover aggiornare anche l'indirizzo del sito (siteurl e home) in base alla nuova porta.

Come faccio a sapere quale programma sta utilizzando la porta 80?

Può utilizzare il pulsante Netstat nel Pannello di controllo XAMPP o eseguire il comando netstat -ano | findstr :80 in un Prompt dei comandi come amministratore. Con il numero di PID alla fine della riga ottenuta, trova il programma nella scheda Dettagli di Gestione attività.

Perché Skype blocca Apache?

Alcune versioni di Skype utilizzano le porte 80 e 443 per le connessioni in entrata. Questo entra in conflitto con Apache. Può risolvere il problema deselezionando questa opzione nella sezione Connessione delle impostazioni di Skype e riavviando Skype.

Conclusione

Il fatto che Apache non si avvii in XAMPP è quasi sempre dovuto a un conflitto di porta. Per prima cosa identifichi il programma che utilizza la porta leggendo il file error.log e l'output di netstat; quindi fermi quel programma oppure sposti Apache su una porta libera come la 8080. Con questi passaggi può risolvere il problema in pochi minuti e riprendere lo sviluppo da dove l'aveva lasciato.

Articoli correlati

WordPress

XAMPP Apache Başlamıyor / Port 80 Hatası Nasıl Çözülür?

Sorun: Apache Neden Başlamıyor?

XAMPP Kontrol Paneli'nde Apache'nin yanındaki Start düğmesine bastığınızda, satır bir an yeşile dönüp hemen kırmızıya geri dönüyorsa ve günlükte şuna benzer bir mesaj görüyorsanız bir port çakışması yaşıyorsunuz demektir:

Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...

Bunun nedeni nettir: Apache, web trafiği için varsayılan olarak 80 numaralı portu kullanmak ister. Eğer bilgisayarınızda başka bir program bu portu zaten kullanıyorsa, Apache başlayamaz. Bazı durumlarda SSL için kullanılan 443 numaralı port da aynı sorunu yaşatır.

Port 80'i Hangi Programlar Kullanır?

En sık suçlular şunlardır: Skype (eski sürümleri 80 ve 443'ü kullanabilir), IIS (Windows'un kendi web sunucusu), VMware, çeşitli antivirüs/güvenlik yazılımları ve bazen World Wide Web Publishing Service adlı Windows hizmeti. Çözüm iki yönlüdür: ya portu kullanan programı durdurursunuz ya da Apache'yi farklı bir porta yönlendirirsiniz.

Çözüm 1: Portu Kullanan Programı Bulun ve Durdurun

Adım 1: Hangi Program Kullanıyor?

XAMPP Kontrol Paneli'nde sağdaki Netstat düğmesine tıklayın. Bu, 80 portunu hangi programın kullandığını gösterir. Alternatif olarak Komut İstemi'ni yönetici olarak açıp şu komutu çalıştırabilirsiniz:

netstat -ano | findstr :80

Çıkan satırın sonundaki PID (işlem numarası) ile programı Görev Yöneticisi'nin "Ayrıntılar" sekmesinden bulabilirsiniz.

Adım 2: Programı Durdurun

Sorun Skype ise: Skype ayarlarından "Bağlantı" bölümüne girip "Gelen bağlantılar için 80 ve 443 numaralı portları kullan" seçeneğinin işaretini kaldırın ve Skype'ı yeniden başlatın.

Sorun IIS ise: Denetim Masası > Programlar > Windows özelliklerini aç/kapat yolundan "Internet Information Services"i devre dışı bırakabilir veya hizmetler (services.msc) üzerinden "World Wide Web Publishing Service"i durdurabilirsiniz.

Çözüm 2: Apache'yi Farklı Bir Porta Taşıyın (Önerilen Kalıcı Çözüm)

Portu kullanan programı kapatamıyorsanız Apache'yi 80 yerine 8080 portuna taşımak en temiz çözümdür.

Adım 1: httpd.conf Dosyasını Açın

XAMPP Kontrol Paneli'nde Apache satırındaki Config düğmesine tıklayıp httpd.conf dosyasını seçin.

Adım 2: Port Numarasını Değiştirin

Dosyada Listen 80 satırını bulup Listen 8080 olarak değiştirin. Hemen altlardaki ServerName localhost:80 satırını da ServerName localhost:8080 yapın.

Listen 8080
ServerName localhost:8080

Adım 3: SSL Portunu Değiştirin (Gerekirse)

443 portu da çakışıyorsa, Apache satırındaki Config menüsünden httpd-ssl.conf dosyasını açıp Listen 443 satırını Listen 4433 olarak değiştirin.

Adım 4: Kaydedin ve Yeniden Başlatın

Dosyaları kaydedin, XAMPP'ta Apache'yi Start edin. Artık siteye http://localhost:8080 adresinden erişeceksiniz. Localde kurulu WordPress siteniz varsa adresini de buna göre güncellemeniz gerekebilir.

Çözüm 3: Yönetici Olarak Çalıştırın

Bazen sorun port değil, izinlerdir. XAMPP Kontrol Paneli'ni kapatıp simgesine sağ tıklayarak "Yönetici olarak çalıştır" seçeneğiyle yeniden açmayı deneyin. Bu, izin kaynaklı başlatma sorunlarını çözebilir.

MySQL de Başlamıyorsa

Aynı sorunu MySQL için yaşıyorsanız genellikle 3306 portu çakışmıştır (örneğin bilgisayarda ayrı bir MySQL kurulu olabilir) ya da veritabanı dosyaları bozulmuştur. Port çakışmasını yukarıdaki netstat yöntemiyle kontrol edebilir, dosya bozulması durumunda XAMPP'ın mysql/data klasöründeki yedeklerden geri dönebilirsiniz.

Hata Günlüklerini (Log) Okuyarak Sorunu Bulma

Apache başlamadığında tahminle uğraşmak yerine, XAMPP'ın size sunduğu günlükleri okumak en doğru yoldur. XAMPP Kontrol Paneli'nde Apache satırının yanındaki Logs düğmesine tıklayıp "Apache (error.log)" dosyasını açın. Dosyanın en altındaki son satırlar, başlatmanın neden başarısız olduğunu açıkça yazar. Port çakışmalarında genellikle "make_sock: could not bind to address" veya "Address already in use" gibi ifadeler görürsünüz. Bir yapılandırma hatası varsa, hatanın hangi dosyada ve hangi satırda olduğu da burada belirtilir. Günlüğü okumak, sorunun gerçek kaynağını dakikalar içinde ortaya çıkarır.

Yapılandırma Dosyası Bozulmasına Karşı Dikkat

Bazen Apache'nin başlamamasının nedeni port değil, httpd.conf veya ilgili yapılandırma dosyalarında yapılan hatalı bir düzenlemedir. Eğer dosyada elle değişiklik yaptıktan sonra Apache başlamamaya başladıysa, büyük olasılıkla bir yazım hatası (eksik tırnak, yanlış yol, kapatılmamış bir blok) yapmışsınızdır. Bu yüzden bu tür dosyalarda değişiklik yapmadan önce mutlaka bir yedek alın; sorun çıkarsa kolayca eski haline dönebilirsiniz. Hatanın hangi satırda olduğunu error.log dosyası genellikle açıkça yazar, böylece yanlış düzenlemeyi hızla bulup düzeltebilirsiniz.

Sıkça Sorulan Sorular (SSS)

Apache'yi 8080 portuna taşırsam sitelerime nasıl erişirim?

Port değişikliğinden sonra sitelerinize http://localhost:8080 adresinden erişirsiniz. Adresin sonuna :8080 eklemeniz yeterlidir. Localde kurulu WordPress siteniz varsa, site adresini (siteurl ve home) de yeni porta göre güncellemeniz gerekebilir.

Port 80'i hangi programın kullandığını nasıl bulurum?

XAMPP Kontrol Paneli'ndeki Netstat düğmesini kullanabilir veya yönetici Komut İstemi'nde netstat -ano | findstr :80 komutunu çalıştırabilirsiniz. Çıkan satırın sonundaki PID numarasıyla programı Görev Yöneticisi'nin Ayrıntılar sekmesinden bulursunuz.

Skype Apache'yi neden engelliyor?

Skype'ın bazı sürümleri gelen bağlantılar için 80 ve 443 portlarını kullanır. Bu da Apache ile çakışır. Skype ayarlarındaki Bağlantı bölümünden bu seçeneğin işaretini kaldırıp Skype'ı yeniden başlatarak sorunu çözebilirsiniz.

Sonuç

XAMPP'ta Apache'nin başlamaması neredeyse her zaman bir port çakışmasından kaynaklanır. Önce error.log dosyasını ve netstat çıktısını okuyarak portu kullanan programı belirleyin; ya o programı durdurun ya da Apache'yi 8080 gibi boş bir porta taşıyın. Bu adımlarla sorunu birkaç dakikada çözebilir, geliştirmeye kaldığınız yerden devam edebilirsiniz.

İlgili Yazılar