Apache doesn't start: syntax error....DocumentRoot must be a directory

19,810

As ETL mentioned, your problem is almost certainly the quote character in DocumentRoot "/var/www/html/form” - you need to use DocumentRoot "/var/www/html/form" (or just DocumentRoot /var/www/html/form, which works fine.).

Never edit a configuration file like this in a text editor that replaces "" with “” or -- with , notably MS Word and Wordpad.

Share:
19,810

Related videos on Youtube

Akylle
Author by

Akylle

Updated on September 18, 2022

Comments

  • Akylle
    Akylle over 1 year

    I read all the previous answer but I couldn't fix my problem.. I'm changing the server where my website is hosted and I'm setting again apache.. Now, after installing php, fail2ban, etc i have that issue:

    service httpd start 
    Avvio di httpd: Syntax error on line 292 of /etc/httpd/conf/httpd.conf: DocumentRoot must be a directory
                                                [FALLITO]
    

    I've already disabled selinux and restarted, but nothing happened..

    sestatus 
    SELinux status:                 disabled
    

    In other answer I read to post that.. But I don't know what it is, but I saw it is very different from other I saw..

    ls -laZ /var/www/html/
    drwxr-xr-x root root ?                                .
    drwxr-xr-x root root ?                                ..
    drwxr-xr-x root root ?                                form
    

    Obviously my httpd.conf has

    DocumentRoot "/var/www/html”
    

    The root I need is

    DocumentRoot "/var/www/html/form”
    

    Now with the default root doesn't work, but before editing some files (I can't remember which) it started correctly. I hope you can help me.. I am using cents 6.5 x64.. Thank you very much

    Andrea

    • Admin
      Admin about 10 years
      DocumentRoot "/var/www/html/form” ... fix your close quote perhaps? Otherwise, give full configuration because obviously there is more.
  • KawaiKx
    KawaiKx almost 10 years
    ahaaa... hours spent to find the fix... just remove those damn quotes!!!!! it is working now
  • JOpuckman
    JOpuckman over 9 years
    +1 You can add Mac's TextEdit to that list of apps as well. Wasted 2 hours trying to figure it out. That will teach me to always use Sublime instead
  • Pacerier
    Pacerier about 8 years
    @KawaiKx, How would that even happen in the first place? Don't you use a plain text editor for config files?