PHP and MySQL don't work after moving localhost location in virtual host
Posted by: codeslayer2010 (65.34.104.---)
Date: April 19, 2022 11:50PM

I'm running WampServer 3.2.6 64-bit and I modified the virtual host for servername "localhost" to point to a different folder (eh__coding) that was not a subfolder of wamp64/ folder.

<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "Z:\EHW_CUSTOM\eh__coding"
<Directory "Z:\EHW_CUSTOM\eh__coding/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

I moved all the files that were in "www/" folder into eh__coding and restarted WampServer. The index.php file for the localhost interface renders, but PHP doesn't work and neither does MySQL. There are some XDebug errors as well.


A SAMPLING OF ERRORS:

Notice: Trying to access array offset on value of type null in
Z:\EHW_CUSTOM\eh__coding\index.php on line 529

Notice: Undefined variable: langues in Z:\EHW_CUSTOM\eh__coding\index.php
on line 468

Notice: Trying to access array offset on value of type bool in
C:\wamp64\scripts\config.inc.php on line 13
Call Stack
# Time Memory Function Location
1 0.2596 369368 {main}( ) ...\index.php:0
2 0.2608 373912 require( 'C:\wamp64\scripts\config.inc.php ) ...\index.php:12


Then at the bottom of localhost page it gives this error:

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/apache/apache2.4.51/bin/php.ini - should be: /bin/apache/apache// or /bin/php/php/phpforapache.ini
You must perform: Right-click icon Wampmanager -> Refresh

I refreshed but it didn't solve anything.

Thanks so much

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote
Re: PHP and MySQL don't work after moving localhost location in virtual host
Posted by: RiggsFolly (Moderator)
Date: April 20, 2022 10:00AM

All I can say is WHY?

Leave the localhost where it is.


Suggestions 1: If you want WAMPServer installed on Z: then unintall it and reinstall it there. Although I dont recommend installing on a network drive. (DONT FORGET TO BACKUP Site and Database(s) first)

Suggestion 2: If you want to develop a site and place its code somewhere else, do so. But create a new Virtual Host for that purpose. There can be hundred of Virtual Hosts if you want them.

Suggestion 3: If you are trying to share develoment of a site, hence trying to place it on a network drive. Dont do it that way. Install WAMPServer on all the devs PC's and teach them all how to use GIT a great source management system

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 04/20/2022 10:14AM by RiggsFolly.

Options: ReplyQuote
[Solved] Re: PHP and MySQL don't work after moving localhost location in virtual host
Posted by: codeslayer2010 (65.34.104.---)
Date: May 10, 2022 04:20PM

RiggsFolly Wrote:
-------------------------------------------------------
> All I can say is WHY?
>
> Leave the localhost where it is.

I put everything back the way it was. All folders and files that were originally installed by Wampserver have been moved back.

> Suggestion 2: If you want to develop a site and
> place its code somewhere else, do so. But create a
> new Virtual Host for that purpose. There can be
> hundred of Virtual Hosts if you want them.
>

I created a new virtual host that points at the external folder, and so far -- except for some WordPress localhost sites that probably just need the site_url in options table changed, all seems to be working as desired. Thanks for your help!

Eric "CodeSlayer" Hepperle, Web Developer & WAMPServer enthusiast
[erichepperle.com]
[github.com]
[stackoverflow.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.