MAMP - suddenly getting 404s on my localhost - mysql

I have a very simple MAMP setup, with my index.php and related files in my htdocs folder. I was rolling along fine last night, being able to access the files by typing in things like localhost/index.php. Now, all of the sudden, I get 404s (file not found on this server) when I try to connect to any of the pages that are in my localhost folder or subdirectories of it.
What's more, when I just type in localhost, it shows me some of the directories but DOES NOT show any of my .php files, even though they show up when I perform a ls in the command line.
My MAMP app shows that I am connected to my Apache/MySQL servers. I can still access the localhost/MAMP homepage. But for some obscene reason, all of the sudden my php files are inaccessible. I have changed nothing inside of them! What's going on?
Edit: Turns out I needed to change the permissions of my php files -- they were set to read and write only for sudo and read only for everyone else. I ran chmod 777 on the applicable files and things were back to normal, but this begs several questions:
Why was it working earlier then changed without me ever modifying the file permissions?
Why should I have to make it writeable for other users to be able to access it on my local host as the admin user?
If I were to deploy this code in the wild (I know MAMP isn't used that often in the wild, but still), what would I do? Wouldn't creating these kinds of permissions result in serious security holes?
EDIT 2: Aaaaaand now it's not working again. Again, no changes made to file preferences, etc., just a few tweaks to the actual php files themselves. I don't have any sharing enabled under my sharing settings in System Preferences... this behavior is really starting to become frustrating.

Open Activity Monitor and make sure all instances of Apache and MySQL are closed. Sometimes MAMP has a tendency to not actually quit those processes and the next time you start it up they're still running and it generally messes with things (how's that for a technical explanation?).
Make sure there isn't any other process that's trying to use localhost for any reason. I came across this problem with POW installed. The POW process had stopped responding and it ended up interfering with MAMP's Apache.
Make sure that MAMP's settings haven't somehow been changes. I've seen MAMP revert custom document roots for seemingly no reason which can cause this.
I'd say even before any of this open your system preferences and make sure your Mac's own built-in Apache is off. You'll be able to see this in the Sharing section (it looks like its been moved in Mavericks however).

Make sure you're not routing traffic through a VPN or SSH using Sidestep. I had this problem after going back to an old project I built with MAMP while working from a coffee shop.

Related

Why do I get a 500 internal server error when trying to access an html file in public_html using cPanel/godaddy?

I have a godaddy website hosted through cPanel, but the html file, named test.html, will not appear when searching "website_name"/test.html. This is the contents of the file:
<!DOCTYPE html><head></head><body>TEST</body></html>
There is no .htaccess, although permissions are set to 644. The server displays the 500 error regardless of whether a valid address was entered. Additionally, the DNS domain and the actual ip address show different things: The DNS shows an index page I can't find in my public_html, whereas the ip shows the godaddy "Future home of something quite cool." message.
Background: I inherited this project as part of a new job. I can set up an apache server with php and mySQL support (in fact I went from using an xampp install to just running everything from command line for practice), but my employer has two godaddy domains: one made using a website building, and one using cPanel for which I am to write my own HTML, CSS, php, js, etc. I have searched extensively across godaddy, google and stack exchange, and have found nothing so far that has worked. The cPanel File Manager has a couple files in it, but nothing will open as a url (I can edit the files though). I checked the godaddy documentation and follow the tutorials and nothing has helped. Any help is appreciated. As an aside, I’m wondering if it would just be easier to completely restart the whole process? The html/css/php files are kind of a hodgepodge and would require rewrites anyway, and bootstrap is used as a source file in every one but never actually implemented. The environment is very relaxed so long as I’m working on something productive.

Wordpress Reinstallation - You don't have permission to access /sitename/ on this server

We've been working hard on a sandbox server. We installed WordPress to it from scratch. I created the database, and imported the previous database into it. The user and password both have been created.
Right now, our error is "403 Forbidden: You don't have permission to access / on this server". I can't access any of the files by typing in the server IP address,though we see and control everything as root via Putty, or manage it through FileZilla. Root is the owner of all WP files/folders.
I found this source: WPBeginner-403-Error-Fix and am currently changing the permissions on the files; the folders are done and the permissions are set to 755. File permissions are being set to 644. Out of all the resources we had referred to, it never mentioned WP requiring specific permissions. I got right onto that today. While this is running, I still get the message after the folder permissions were changed, and as the file permissions are being processed:
You don't have permission to access /wp-admin/login.php on this server.
We also had a bootstrap file located in the same place as the WP installation / contents (this was a test). The bootstrap is very much accessible: the CSS/JS folders with the supporting content can be seen if you type the ipaddress/directory for the bootstrap version... you can see the files and structure. If you type in ipaddress/boot.html, it runs it flawlessly. If we try referring to anything with WP, it does not like it and throws the 403 error.
There is no .htaccess, I read online it would generate via permalinks in the panel. But we can't even see the panel. It's currently .htaccessOLD (from when we imported our old WP contents to the dev server, from the production site), so there should be no interference.
None of us has installed WP directly, the guy who did it previously no longer is part of the company, so we are becoming lost in this process.
Edit: Plugins were disabled via renaming convention, however, WP actually regenerated this folder.
Edit (2): With the permissions set, and the plugin/theme deactivated, it still does not run due to 403.
Weird... my answer didn't post yesterday as I had thought.
So- we solved it. The permissions were set accordingly for all directories/files, the issue was the server configuration. Just triple check the server configuration file (usually httpd.conf on current servers) to ensure it points to the directory containing the WP contents.
If this is still a problem to some people, and you swear that the httpd.conf file is correct, it does not hurt to double check your directories. The directories should be permission 755. Files should be 644, excluding the wp-config.php (that ought to be set for permissions 455).
Thank you for helping us troubleshoot! We really appreciated it! :)

PHPStorm cache on downloaded files?

So I've used PHPStorm before, and have been asked to evaluate it (along with some other coworkers) as I already had my own private license, for how effective it would be with my current company. Although I'm hitting a bit of a snag that I really dont think should be a show stopper.
Anyway, the way my company has its development environments setup now is a bit odd. We check everything into subversion, into different directories than what it will end up on the clients system because we save them to debian packages. This makes working with the files directly from subversion difficult, as PHPstorm has no idea where related files are located.
However, because of this, our files on our development virtual machines are not directly under subversion. Instead, we patch up our virtual machines by installing the updated packages when needed.
This makes life difficult for an IDE, which wants to keep a local copy of the files on your system. The best way I can figure out how to do this, is to run a synchronize between the remote server and local server (going by timestamp and size should be fine, and completes in less than a minute). It would be fine to tell developers "after you patch, make sure you sync with phpstorm".
However, the problem I'm having is, if I modify a file on the remote system, sync (and it says it downloaded) it takes several minutes after opening the file for the remote changes to be seen in phpstorm
I have no idea why this would be, and could potentially lead to really bad results if someone makes a few quick changes, saves, and overwrites the needed files.
I'm currently running phpstorm on Ubuntu 14.04 64-bit
Any help would be appreciated

Xampp and Ampps don't reload files when changed

When I change a file in the directory, the change is not reflected on the web page shown when I access it through localhost, but it is shown when I access it directly by the file path on my system. Why?
I am on a Windows machine. My files are stored at C:\Program Files (x86)\Ampps\www\connor.dev . When I directly reference a file, by going to a link like this in the browser, file:///C:/Program%20Files%20(x86)/Ampps/www/connor.dev/index.php, the changes I made and saved in Sublime Text are shown. When I access it by going to localhost/connor.dev/, the changes are not shown. Even if I delete the file completely, it is still shown in localhost. This started happening recently on xampp, so I uninstalled it and used Ampps, and now the same thing is happening. If you need more info please ask.
Press Ctrl-F5 to hard refresh the page (to not use Browser's cache).
If you still see the previous pages or changes, then Apache has mod_cache caching them, or PHP has its opcode cache settings set to not refresh changes for X amount of time.
I'm using Bitnami and the way I fixed it was to go inside C:\Bitnami\wappstack-version-number\php\php.ini, you can make the following changes and then reset your server:
opcache.enable=0
opcache.revalidate_freq=0
My php was updating every 60 seconds before, so I decided to turn that to 0 and just disable caching.
Its happening because of apache mod_cache caching the resources.
For quick fix. Just restart the Apache server.
In ubuntu i use this below command in terminal to restart the Apache server
systemctl restart apache2
Now refresh the browser, then you will get the updated one.
It comes out to be an issue with the cache thing, so in simple words all you have to do is to remove the cached data of the specific webpage.

Can html5 be used front end for an ftp server?

quick question to day. I've done a little digging around on the net and i can't really find a very definitive answer.
Basically, I run my own server on a redundant dual core, 4gb ram 2Tb pc (server1)
And on here, i would like to make an FTP partition. Reason being, i would very much like to be able to transfer files back and forth work, uni and home as i please.
I also run a website from my server which allows me to stream media from my hard drive to any laptop, tablet, desktop, iphone, android.. you name it!
I would LIKE to be able to add a section on my website where by I can log in and access my files as a sort of HTMF5 Front end.
I am aware and know how to create a login with a database which has md5 hash and store cookies to stop un-authorised people accessing my ftp.
Any help or a shove in the right direction would be much appreciated! Thanks in advance :D
Yes it's possible. but that won't be HTML5 ftp server etc that you mentioned.
You can achieve this by installing a web server on your machine like apache and then make directories public - run Apache on some port and you will be able to access the directory. if your server is running on port 8080, URL will be like: domain.com:8080 - You can style directory using this simple script & make this password protected as well using .htaccess .
osFileManager
The other option is to use some php script. Many commercial scripts are available and as well as open source. i recommend you trying osFileManager - it has a lot of features like:
Browse the directory structure
Create files
Upload files
Rename files
Move files
Delete files
Edit files
Change permissions
Change password
Create users
Here is it's installation instructions: http://www.osfilemanager.com/osfilemanager-docs.html
or a paid HTML5 & AJAX based script can be bought for 14$ from here:
http://codecanyon.net/item/file-manager-and-backup-system/5177206