Apache does not start with spaces in pathname in httpd.conf (even with quotes)

Problem

Apache does not start if there are spaces in the path of the virtual host configuration.

The usual solution is to simply wrap the path in double quotes, but this does not fix it.

I WANT to have spaces in my path name, so change the dash or that is actually not an option.

VERY same configuration as below, with no spaces.

Example

<VirtualHost *:80> DocumentRoot "C:/Users/Patrick/Google Drive/Projects/My Project" ServerName local.example.com ServerAlias local.example.com <Directory "C:/Users/Patrick/Google Drive/Projects/My Project"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Order allow,deny Allow from all <IfModule mod_php5.c> php_admin_flag engine on # choose the one you want: # This is for E_ALL & ~E_STRICT & ~E_DEPRECATED # php_admin_value error_reporting 22527 # This is for E_ERROR php_admin_value error_reporting 1 </IfModule> </Directory> </VirtualHost> 
+4
source share
5 answers

Have you tried DocumentRoot "C: / Users / Patrick / Google \ Drive / Projects / My \ Project"?

+8
source

I have the same problem on Windows 7 with wampserver 2.4. The same configuration works on a unix system, but not on windows.

Did you find a solution to this problem?

UPDATE:

I found a solution in this section: Use the Google Drive directory as an Apache virtual host

The problem is not the problem. If you need spaces in the path, insert your path between double quotes. The problem is the problem with permission files.

0
source

If you are still looking for a solution, you can try creating a connection that allows you to move the contents of the root folder to the path with spaces. I did this and it works without problems.

You need Microsoft's Junction . I think you can create connections without it, but it is more complicated.

Create the apache_root.bat file to pass the junction.exe commands and reuse it if you delete the connection and you need to recreate it:

 "G:\SysinternalsSuite\junction.exe" "G:\UniServerZ\www\test" "G:\Google Drive\test" 
  • The first line is the path to juction.exe. I think you can only write "junction.exe" if the .bat file is in the same folder;
  • The second line is the path to the juction folder. In my case, this "test" folder is created
  • The third line is the source of the connection folder. In my case, this β€œtest” folder exists and has subfolders.

I use Uniform Server, which is portable and has the root folder "www" inside the UniServerZ folder. Each time I upgrade the server, I delete the entire UniServerZ folder and run the .bat file to recreate the test folder.

Of course, the original folder is not deleted when the connection is deleted. Beware of the SymLinks that I see in your configuration file, they delete the original folder. I almost screwed up my Windows by deleting the symlink.

0
source

Put the directory path in double quotes, for example:

 DocumentRoot "C:\Users\Touhid Mia\OneDrive\xxx" <Directory "C:\Users\Touhid Mia\OneDrive\xxxxx"> 
0
source

I worked using DOS 8.3 paths:

 c:/users/patric~1/google~1/projec~1/myproj~1 

You can see the DOS path using dir /x on the command line.

0
source

All Articles