by CliffMitchell » 10. December 2014 15:43
Thanks Nobbie. I have just done (yet another) clean install of XAMPP (versions as above). Without making any changes to any of the installed config files I get this:
http://localhost takes me to the XAMPP for Mac OS X home page as you would expect - good, everything works!
I then create a folder for my site called shawcottage as: /Applications/XAMPP/xamppfiles/htdocs/shawcottage and put into this a test file called test.php.
http://localhost/shawcottage/test.php works perfectly - it takes me to test file test.php and this outputs exactly what I would expect. Good - php works and appache is correctly linking to my site files.
I then amend test.php so that is simply contains:
<?php
echo "Document_route = " . $_SERVER['DOCUMENT_ROOT'];
?>
When I run this (http://localhost/shawcottage/test.php) the output is: Document_route=/Applications/XAMPP/xamppfiles/htodcs
Notice that the document root is not showing shawcottage on the end. Again, this is pretty much as expected. With XAMPP under Windows or Ubuntu I would now change the http.conf file to point to the shawcottage folder. Let's forget about setting up more sophisticated virtual hosts at this point - I tried that under OS X and that didn't work either, so keeping thing simple...)
I now edit the httpd config file: /Applications/XAMPP/xamppfiles/etc/httpd.conf and change the line
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
to: DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/shawcottage"
and restart apache. Under Windows and Ubuntu that's all I need to do (different directory paths of course) for everything to work correctly.
With OS X when I browse http://localhost it works and takes me to the XAMPP for Mac OS X home page as you would expect - good, everything still works!
When I run my test file http://localhost/shawcottage/test.php) the output is: Document_route=/Applications/XAMPP/xamppfiles/htodcs so nothing has changed. At this point I checked the XAMPP control panel (from where I restarted apache) and I can see that apache is running but in the Application log is an error message:
Restarting Apache Web Server...
Exit code: 8
Stdout:
apache config test fails, aborting
apache config test fails, aborting
Stderr:
AH00526: Syntax error on line 229 of /Applications/XAMPP/xamppfiles/etc/httpd.conf:
DocumentRoot must be a directory
AH00526: Syntax error on line 229 of /Applications/XAMPP/xamppfiles/etc/httpd.conf:
DocumentRoot must be a directory
Line 229, of course, is where I changed the DocumentRoot setting. So, it's no wonder nothing changed, just surprising that apache restarted at all!
So, my immediate problem is that I cannot change the DocumentRoot setting in httpd.conf. What am I doing wrong?
Thanks,
Cliff
Last edited by
CliffMitchell on 10. December 2014 18:42, edited 1 time in total.