MAMP avoid index file opening by default - mamp

Just a quick question concerning MAMP.
When going through the hard drive through the "localhost command" in my browser, upon opening a folder which contains a index.html file, how to stay in file browsing mode without it rendering the index file right away? Its a fresh MAMP install, the only setting I made was redefine my "Username/Sites" folder as localhost.

Locate following line in httpd.conf in your MAMP folder:
DirectoryIndex index.html index.php
Remove index.html and restart MAMP.
See also: http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex

Related

Renaming files doesn't take effect in VScode while using WSL2

I have a very annoying problem in my VScode setup.
I'm using WSL as a terminal to work on my projects and occasionally, mistype the name of one of the folder or file that I'm working with.
For example:
I accidentally created the Mainheader.js file in layout folder (without the capitalized L) therefore, I decided to rename the folder with a capital L.
Now on my React app, any changes made to MainHeader.js file will not be reflected. I did update the related import.
So I decided to delete the entire folder and recreate it with MainHeader.js but this is what I end up with.
The file is there in my folder but when I click on it, I get
"Unable to open Mainheader.js - File not found"
So I try to create it then I get this error:
Unable to create file 'wsl\path]to\MainHeader.js' that already exists when overwrite flag is not set
Has anyone run into this type of behavior in WSL before? It's quite annoying because the only workaround I've found so far is to create a completely different folder with a different name...
Any help would be appreciated. I can't really work like this.
I've been having the same problem for the past 2 days. I presume its a permissions issue, but unfortunately I don't know how to permanently fix it.
I did find this work-around though:
Open a new VS Code window. (I'd recommend closing any VS Code window that had
your project directory open.)
Create a duplicate or copy the contents of the problem file so you don't lose
your code.
Delete the problem file.
Now create the file again using VS Code. Go to File > New Text File. Next paste
in your code.
Now save your new file. Go to File > Save As and save your new file with at the same path + filename + extension that was giving you problems previously. VS Code should allow you to save the new file without any issue.
Now you can open this new VS Code window to your project directory and you should be able to continuing accessing the file that was a problem before.
Basically we just deleted the problem file and then created it again from scratch in a new VS Code window.
Hope this work-around works for you!
EDIT 09/20/2022
Following Baza86's answer here solved the issue for me. Seems like it was a permissions issue of sorts, but if you use the Remote-WSL extension VS code can directly access the linux filesystem.
How to run VScode in sudo mode in WSL2?
You may need add the case option to you options in the wsl config. The default is set to off, however you can set this to off, dir or force.
Open your wsl.conf using sudo with any text editor while running window subsystem Linux. The config file resides in /etc/wsl.conf. This file is used to configure settings per-distribution for Linux distros running on WSL 1 or WSL 2.
My default config looked like this yours may be different:
[automount]
options = "metadata"
add
[automount]
options = "metadata,case=dir"
Here is the official Microsoft docs for Advanced settings configuration in WSL - https://learn.microsoft.com/en-us/windows/wsl/wsl-config

VSCode looking for file in wrong directory

I'm working on Laravel project. When I want VSCode jump to class's file in vendor, just got issue that it can't open file in correct location.
My working directory is C:\wamp64\www\merchant but VSCode try to open the file from C:\wamp64\www\wallet
My question is that is there anyway to tell VSCode the correct working directory?
delete folder .phpls (~/.phpls or %USERPROFILE%\AppData\Local\PHP Language Server\ on Windows)
is the way to clear VSCode PHP extension server cache.

run file in browser from vscode

just installed vscode and I'm missing a trick which I think should be obvious but I just can't seem to find the answer.
I run apache as my local test server. When I'm in vscode and have a root folder open I would like to be able to send any file I'm editing to my browser and use the root folder name + relative path to file in the url sent to browser.
so what I actually want to send to browser is full url :
http://localhost/current-root-folder-in-vscode/relative-path-to-file
the file could be the open open one or one listed in vscode explorer which is not open.
suggestions much apprceiated.
p.s. I have searched possible vscode extensions and haven't found anything that seems to do it.
Fixed. I edited View-In-Browser extension locally to make it work the way I want.

emacs can't open files outside current directory

So here is an interesting error...there is a particular folder on my desktop (hdrive, connected to a university-wide backup system, was set up automatically by IT) where emacs has difficulty opening files. In some directories within hdrive emacs can't open files above the current directory. For example,
cd ~/hdrive/directory/
emacs ../another_directory/file
gives the error message
emacs: `get_current_dir_name' failed: No such file or directory
I get the same error if instead I try
emacs ~/hdrive/another_directory/file
The files themselves are not missing and not corrupted, as using cat in place of emacs in these commands works fine. And I don't get this problem with all directories in hdrive - sometimes even a directory with this problem will have a subdirectory without it - but the directories with this problem are consistent.
There is no .dir-locals.el anywhere in hdrive, so that can't be messing things up.
Any ideas?
For me, this problem occurred because I was standing in a folder that I had deleted and recreated in another terminal (git issue).
Navigating away from the folder and back again made emacs and/or the terminal understand which folder I was actually in, and I could start emacs again with no problems.
I doubt this will solve the specific issue the questioner had, but anyone else ending up on this page through a google search on the error message might find my answer useful.

php.ini resetting on MAMP server restart

I am trying to change display_errors = Off to display_errors = On in my php.ini. I ran phpinfo() and verified the Loaded Configuration File (it is located here: /Library/Application Support/appsolute/MAMP PRO/conf/php.ini).
Everytime I edit the display_errors value of this php.ini file and restart my MAMP server, the php.ini file seems to reset. If I open the php.ini file again after restarting MAMP it shows display_errors = Off.
Why might MAMP be resetting the php.ini file?
note - I'm using MAMP Pro if that makes a difference.
The way I have done it was to change the template that MAMP Pro replaces your php.ini file with. In my case the ini file that PHP was loading was found at
/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
but everytime I changed it, MAMP Pro wrote over it with its own version. To change what I wanted to change in the php.ini file, I simply found the template:
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/php5.4.4.ini
(PHP 5.4.4 is the version i'm using) and then I changed what I needed to change :D Hope this helps
You can set php.ini values with the template editor in Mamp Pro.
File -> Edit Template -> PHP (php.ini)
Select the same version your instance is running.
When you save the template Mamp will overwrite the php.ini file used for your instance and restart Apache.
I finally figured it out. MAMP Pro works differently than regular MAMP. With regular MAMP you would edit the appropriate php.ini file directly. With MAMP Pro however you have to use the MAMP Pro interface to control the php.ini settings. MAMP Pro recreates the php.ini file each time the server starts based on these settings.
In my case, to display server errors I had to open the MAMP Pro interface. Click on the Server tab. Click on the PHP tab. Check the Display startup errors checkbox. Check the All errors and warnings checkbox. Check the Display checkbox. Apply the changes and restart the server.