Asked  2 Years ago    Answers:  5   Viewed   91 times

I am sure this question is being asked many times but I am not encounter with a problem. I am using XAMPP where I configure Zend framework.

XAMPP is running on port 8081 as 80 is being occupied by some Windows process I need to use virtual host for that I configure with following code in C:/xampp/apache/config/extra/httpd-vhosts.config (or C:/xampp/apache/conf/extra/httpd-vhosts.conf in newer releases).

<VirtualHost *:80>
ServerName comm-app.local
DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
SetEnv APPLICATION_ENV "development"
    <Directory "C:/xampp/htdocs/CommunicationApp/public"
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>    

and also update the hosts file with 127.0.0.1 comm-app.local and try to re-start apache but it is showing error.

15:03:01  [Apache]  Error: Apache shutdown unexpectedly.
15:03:01  [Apache]  This may be due to a blocked port, missing dependencies, 
15:03:01  [Apache]  improper privileges, a crash, or a shutdown by another method.
15:03:01  [Apache]  Press the Logs button to view error logs and check
15:03:01  [Apache]  the Windows Event Viewer for more clues
15:03:01  [Apache]  If you need more help, copy and post this
15:03:01  [Apache]  entire log window on the forums

 Answers

4

I see two errors:

<VirtualHost *:80> -> Fix to :8081, your POrt the server runs on
    ServerName comm-app.local
    DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
    SetEnv APPLICATION_ENV "development"
    <Directory "C:/xampp/htdocs/CommunicationApp/public" -> This is probably why it crashes, missing >
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
 -> MIssing close container: </VirtualHost> 

Fixed version:

<VirtualHost *:8081>
    ServerName comm-app.local
    DocumentRoot "C:/xampp/htdocs/CommunicationApp/public"
    SetEnv APPLICATION_ENV "development"
    <Directory "C:/xampp/htdocs/CommunicationApp/public">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

One thing to mention:

You can always try and run command:

service apache2 configtest

This will tell you when you got a malformed configuration and maybe even can tell you where the problem is.

Furthermore it helps avoid unavailability in a LIVE system:

service apache2 restart

will shutdown and then fail to start, this configtest you know beforehand "oops I did something wrong, I should fix this first" but the apache itself is still running with old configuration. :)

Thursday, December 15, 2022
4

Ioncube must be loaded before any other extension, so to fix this problem do this:

  1. goto /etc/php5/conf.d
  2. type mv ioncube.ini 01-ioncube.ini
  3. restart apache service apache2 restart
  4. Enjoy with ioncube and xdebug :)
Thursday, August 18, 2022
 
1

Xdebug v2.0 shouldn't work with PHP 5.3. Xdebug v2.1 provides PHP 5.3 support. Otherwise I would get rid of the xdebug ini config except:

zend_extension_ts = "C:xamppphpextensionsphp_xdebug.dll"
xdebug.remote_enable   = On
xdebug.remote_host     = "localhost"
xdebug.remote_port     = 9000
xdebug.remote_handler  = "dbgp"

use this as your test and once this works then add additional configs. Make sure you comment out other zend stuff.

Wednesday, August 17, 2022
 
jcuenod
 
2

The hosts file should look like this so that it can be found on the IPV4 and IPV6 networks

127.0.0.1  localhost dev.app
::1        localhost dev.app

If you are using Apache 2.4.x this line in httpd-vhosts.conf

NameVirtualHost *:80

is no longer required or allowed for Apache 2.4.

The vhost file should look like this, you mixed Apache 2.2 and 2.4 syntax and while either is allowed as long as you have mod_access_compat activated, you should not mix them and the 2.4 syntax is better. You also missed a few other useful bits and pieces

<VirtualHost *:80>
    DocumentRoot "F:/xampp/htdocs/"
    ServerAdmin [email protected]
    ServerName localhost

    <Directory "F:/xampp/htdocs/">
       Options Indexes FollowSymLinks
       AllowOverride all
       Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "F:/xampp/htdocs/dev/public"
    ServerAdmin [email protected]
    ServerName dev.app
    ServerAlias www.dev.app

    <Directory "F:/xampp/htdocs/dev/public">
       AllowOverride All
       Options Indexes FollowSymLinks

       Require local
       # if you want access from other pc's on your local network
       #Require ip 192.168.1
       # Only if you want the world to see your site
       #Require all granted
    </Directory>
</VirtualHost>
Friday, August 5, 2022
 
elmalto
 
2

The context for VirtualHost has to be server config. See the Apache docs.

This means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any or containers. It is not allowed in .htaccess files at all.

(Directive Dictionary)

Friday, September 9, 2022
 
wtjones
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages