简体   繁体   中英

Virtualhosts config works on XAMPP 5.6.15 but not XAMPP 7.0.1

2x Windows 10 Pro computers with recent clean installs. 1 a couple of weeks old the other days. Am I forgetting to configure something?!

Both are listening to the right ports.

Code looks like this: (I'm 100% sure paths point to the correct folders too)

NameVirtualHost *

<VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:81>
    DocumentRoot "Path1"
    ServerName project1.dev
    <Directory "Path1">
        Options all
        AllowOverride all
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:82>
    DocumentRoot "Path2"
    ServerName project2.dev
    <Directory "Path2">
        Options all
        AllowOverride all
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

localhost:80 still works on both, but if I try using each project's port to access their respective pages it only works on the oldest installation.

Just says it can't reach the page no error, ether from the same machine or access trough LAN and WAN.

I'm out of ideas... Thanks for your time.

Edit: I forgot to mention Apache doesn't seem to be logging the access attempts on the newer installation. It logs if I access the dashboard or phpmyadmin but not if I try using the ports for the projects' websites.

Edit2: I have confirmed both virtualhosts are active using httpd -D DUMP_VHOSTS . So now the issue seems to be that I'm unable to simple access the virtualhosts for some reason. Something is blocking the connection between my browsers and apache irrelevant of it I'm local or networked.

Edit3: Important update - I tried installint xampp on another computer and trying it out and it still didn't work. But while installing I remembered I was installing the latest version XAMPP 7.0.1. So I installed XAMPP on yet another computer but now using the old XAMPP 5.6.15 version that was working on the older windows instalation and guess what, it works. So the problem is related to the updated XAMPP and possibly nothing else. I'll update the title too.

Edit4: Now that I know it's something related to XAMPP/Apache I went back to the virtualhost config and by trial and error noticed that it's something related to Require all granted as removing it or changing to Require all denied now returns a 403 error Access forbidden! page (improved from simply not being able to connect). Since all pages that suggest fixes for the 403 error involve Require all granted I'll have to keep digging.

Edit5: Important Update - I decided to see if it could be something related to my files so I started deleting some. Deleting my index.php made things work again so I dug deeper and noticed that If I deleted the code I have regarding Sessions everything would load as expected. So now it seems it's something specific to the way PHP 7.0.1 handles sessions.

Edit6: Ok, it's specifically Session_start(); that's breaking things.

It's a bug in the latest build of XAMPP... Xampp 7.0.1 Apache crashes when I use session_start()

we have been checking the configuration of XAMPP and we found that the issue is related to the use_only_cookies variable that you can find in the Session's section of the php.ini file. Apache will crash if the use_only_cookies variable in the Session's section is set to 0 and everything is fine if it's set to 1.

http://php.net/manual/en/session.configuration.php#ini.session.use-only-cookies

We also checked that the use_strict_mode should be set to 1.

https://wiki.php.net/rfc/strict_sessions http://php.net/manual/en/session.configuration.php#ini.session.use-strict-mode

We'll include those changes in the next version of XAMPP with PHP 7. We are building the installers with the version 7.0.2 and we'll release them as soon as possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM