xampp apache web server not starting, exit code 8 - php

My knowledge is very limited with these apache settings. I wanted to have multiple sites that I could work on locally.
Yesterday it worked okay after installation but after shutting down and starting again today, it did not work.
Server won't start and Application log says:
Starting Apache Web Server...
Exit code: 8
Stdout:
apache config test fails, aborting
Stderr:
AH00526: Syntax error on line 237 of /Applications/XAMPP/xamppfiles/etc/httpd.conf:
DocumentRoot must be a directory
It is a folder
httpd.conf
line
237 DocumentRoot "/Users/username/Sites/xampp/site-folder”
238 Directory "/Users/username/Sites/xampp/site-folder">
Any ideas what is wrong and what to do?
Thanks,

Well, It is because of the comma that your text editor changed from " to ” after site-folder”
237 DocumentRoot "/Users/username/Sites/xampp/site-folder”
238 Directory "/Users/username/Sites/xampp/site-folder">
Change to:
237 DocumentRoot "/Users/username/Sites/xampp/site-folder"
238 Directory "/Users/username/Sites/xampp/site-folder">

xampp is Windows, isnt it? lampp is for linux so I guess you want to use a Folder in your Users Home-Directory. (UPDATE: whoops, lampp is the old name, but maybe this answer suits ur needs).
Try
<Directory "C:\Users\username\Sites\xampp\site-folder">
</Directory>
Windows directory seperator is "\" as you can see if you start your "Explorer" and navigate through directories. "C:" is just the default partition where usually windows is installed. If your installation is somewhere else (or if you changed your Users-Directory path to another drive/partition) just change "C:" to wherever your directory is on.

if you are running xampp under windows, you should add the drive letter also eg:
DocumentRoot "C:/Users/username/Sites/xampp/site-folder”
<Directory "C:/Users/username/Sites/xampp/site-folder">
(note that windows uses the \ (backslash) character, but in apache config files you should always use / (slash) instead of \ when you reference directories.)

Related

How to change xampp htdocs directory in Mac OS Big Sur

I have installed Xampp 7.2.34 from https://www.apachefriends.org in Big Sur.
XAMPP htdocs folder is placed in /Applications/XAMPP/xamppfiles directory. Is there anyway that I can change the location of htdocs folder and place all my projects in the new location.
Current Location: /Applications/XAMPP/xamppfiles/htdocs
Desired Location: /Users/user/Desktop/Work/PHP/htdocs
I am following this question in Stackoverflow but it seems quite old and I was not able to accomplish what I required.
Already done:
Created new empty htdocs folder on desired location
Changed User daemon to User user in xamppfiles/etc/httpd.conf
Didn't change Group daemon
Changed DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" to DocumentRoot "/Users/user/Desktop/Work/PHP/htdocs" in xamppfiles/etc/httpd.conf
Changed <Directory "/Applications/XAMPP/xamppfiles/htdocs"> to <Directory "/Users/user/Desktop/Work/PHP/htdocs"> in xamppfiles/etc/httpd.conf
I also uncommented this line of code Include etc/extra/httpd-vhosts.conf in xamppfiles/etc/httpd.conf
Result:
Access forbidden! error.
What did I miss? Has something changed in these years? TIA.
I have the same issue, but worked with this this solution. You could using Xampp in another version, Xampp 7.4.15 with this configuration
This worked for me using XAMPP 8.2.0 and macOS 12.6.2 Monterrey:
Make a copy of htdocs and put it where you want it. In my case, I made my copy in /Users/me/Dropbox/XAMPP/htdocs
Edit /Applications/XAMPP/xamppfiles/etc/httpd.conf
Change
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs”
to
DocumentRoot "/Users/me/Dropbox/XAMPP/htdocs"
Change
<Directory "/Applications/XAMPP/xamppfiles/htdocs”>
to
<Directory "/Users/me/Dropbox/Programming/XAMPP/htdocs">
Change
User daemon
to
User me (your user name)
Edit /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php
After
$cfg['SaveDir'] = '';
add
$cfg['TempDir'] = '/tmp';
Edit /Applications/XAMPP/xamppfiles/properties.ini
Change
apache_htdocs_directory=/Applications/XAMPP/xamppfiles/htdocs
to
apache_htdocs_directory=/Users/me/Dropbox/Programming/XAMPP/htdocs
Save the files and restart the servers.
That was it. Hope helps someone. I looked for this answer for a long time.

wamp apache 2.4.9 not started after adding virtual host in httpd.conf

I am using wamp (php v 5.5.12, apache v 2.4.9). When I start the apache server the icon becomes green as if everything is fine. I can access to all services with no problem. When I try to add a virtual host to configure in httpd.conf for my symfony project apache will not restart.
<VirtualHost *:80>
   DocumentRoot C:\wamp\www\tuto\Symfony\web
    <Directory "C:\wamp\www\tuto\Symfony\web">
        DirectoryIndex app_dev.php
        Options -Indexes FollowSymLinks SymLinksifOwnerMatch
        AllowOverride All
        Allow from All
    </Directory>
</VirtualHost>`
The server icon then stays in yellow instead of green and I can't access to localhost url. When I remove my config, everything becomes normal again. Please help me to understand how I can resolve this.
You have a single-quote at the end of:
</VirtualHost>`
Remove it.
You can use the symfony 2 built in server . first undo any changes on your httpd.conf
open your cmd and do this:
cd C:\wamp\www\tuto\Symfony\web
next
php app/console server:run
now try this on your browser: http://127.0.0.1:8000
this is equal to : http://localhost/tuto/Symfony/web/app_dev.php
if you want to start web server on your local ip use this
php app/console server:run yourIP:port
It's solved, thank you guys !
What I did :
1-Adding my conf in httpd-vhost.conf with ServerName parameter
ServerName www.project.com inside section as #skrilled said.
2-In the httpd.conf, Uncomment this line : Include conf/extra/httpd-vhosts.conf
3-In the system file "hosts", I added this line : 127.0.0.1 www.project.com

How to change LAMPP webserver root document?

How to change LAMPP webserver root document? The default is localhost/xampp/ in /opt/lampp/htdocs But I have a different folder in the /opt/lampp directory and there I have my main website document which I want to load by default. How can I do this? I tried to edit the httpd.conf file in the /opt/lampp/etc and so far I did this but it doesnt seem to work : I commented out 229 line (DocumentRoot "/opt/lampp/htdocs") and added DocumentRoot "/opt/lampp/folder" and also commented by prepending # 231 line (<Directory "/opt/lampp/htdocs">) and added <Directory "/opt/lampp/folder>". What I did wrong or what else needs to be done?
You have to restart your server after editing the config file.

Silently install Apache with php and files

I am writing a C++ installer and want to have it perform the following tasks without user interaction:
Silently install an instance of Apache
Silently add PHP to said apache instance
Determine the DocumentRoot of the apache instance and copy a bunch of php files to that location
Currently I have it installing apache using this command: apache_2.2.6-win32-x86-no_ssl.msi /passive ALLUSERS=1 SERVERADMIN=admin#localhost SERVERNAME=localhost SERVERDOMAIN=localhost SERVERPORT=80. This silently installs apache with the specified settings and leaves the services automatically started. Perfect.
The problem is that after this I don't know how to get the DocumentRoot that Apache uses (it is by default C:\Program Files (x86)\Apache Software Foundation\Apache\htdocs on my test computer), so I don't know where to send the files. So I either need to:
Control the location of htdocs (preferable)
Find a way to dynamically grab the DocumentRoot
Thanks!
You'll need to parse the Apache/conf/httpd.conf file then change the DocumentRoot value to what location you want him to point at.
Find this
DocumentRoot ".*"
Change it to
DocumentRoot "Your Location"
To find the location of the httpd.conf knowing that the default installation folder of apache is Programe Files ...
Using the win 32 API
TCHAR pf[MAX_PATH];
SHGetSpecialFolderPath(
0,
pf,
CSIDL_PROGRAM_FILES,
FALSE );
http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx
Then add \Apache Software Foundation\Apache\conf\httpd.conf to the program files folder to locate the httpd.conf file

Can't view index.php of Zend Framework 1.0 after setting up Apache/Host requirements?

UPDATE: the following error is coming up in the Apache error logs...
[Sat Dec 08 16:41:39 2012] [error] [client 127.0.0.1]
PHP Fatal error: require_once():
Failed opening required 'Zend/Application.php'
(include_path='/Library/WebServer/Documents/quickstart/library:.:/php/includes:/Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library')
in /Library/WebServer/Documents/quickstart/public/index.php on line 18
I'm using Mac OSX 10.8.2 (Mountain Lion) and I'm having problems getting the Zend framework set-up and running (just the basic QuickStart).
I'm using Apache 2.2.22
My localhost files are accessible from /Library/WebServer/Documents
I have PHP 5.3.15 running as well.
I've created a new project via the command line (using the zf.sh file) called 'quickstart' (as per the section on the Zend website recommends) and that is stored here: /Library/WebServer/Documents/quickstart
I've followed both the official Zend website instructions and also an online book about installing Zend: http://www.survivethedeepend.com/zendframeworkbook/en/1.0/creating.a.local.domain.using.apache.virtual.hosts
My php.ini (/private/etc/php.ini) file has been updated to include the path to the library folder inside the ZendFramework directory...
include_path = ".:/php/includes:/Users/<home>/Dropbox/Library/PHP/ZendFramework-1.12.0/library"
I've updated /etc/apache2/httpd.conf so it includes...
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Ensure "localhost" is preserved unchanged pointed
# to the default document root for our system.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot /Library/WebServer/Documents/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /Library/WebServer/Documents/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
...I've also updated /etc/hosts so it includes...
127.0.0.1 localhost
127.0.0.1 quickstart.local
I'm restarting Apache using sudo apachectl graceful (I've also used sudo apachectl restart)
So if I try and now access http://localhost/ I see my /Library/WebServer/Documents directory and I can see PHP is running still with no problems. But if I try and access http://quickstart.local/ I just get an empty page?
Can any one advise as to what the problem might be, what I'm missing and what I can do to get the initial 'welcome' page to display.
I'm sure I'm just missing someone small, but it's obviously causing problem enough for the basic page not to show.
Thanks.
Mark
Just for others who may have followed this. The answer by Kamil, above, will work, but opens a security hole outside Apache's security configuration. That's fine as long as you know it and have another layer of security above Apache.
Another way to resolve the problem is to put the ZendFramework somewhere inside the root directory's hierarchy. Like:
DocumentRoot/Library/WebServer/Documents/ZendFramework-1.12.0/library
or
DocumentRoot/Library/WebServer/Documents/quickstart/public/ZendFramework-1.12.0/library
Any path that's inside the root directory of your Apache server.
Maybe a user permissions issue between the Zend files and the Apache process.
Since you can create the project using zf.sh, the Zend files are obviously there. But the fail you get via Apache suggests that the Zend files might not be accessible via the Apache process (that is, the user under which the Apache process runs).
$ chmod 0777 /Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library
to test.
You could probably get away with much less expansive permissions - 0644, for example - but I confess I'm terrible at that aspect of it. ;-)

Categories