Yes, I read through a lot of the related questions, but I can't seem to make sense of my problem. So, I successfully installed the latest Apache server along with PHP5 on a Pi. It works as it should, including PHP. I was able to view the default index.html page and also my test.php file from another Raspberry Pi and a Linux PC. Then, I took the MicroSD card from the Pi and inserted it on another Raspberry Pi. Now, I can't seem to access the default index.html or my test.php from any machine or Pi and it always says 403 error. I don't understand it. I thought anything and everything that you install on Pi is contained within the MicroSD card. So, switching from one Pi to another Pi shouldn't make any changes as far as any system settings go. Even the user on both RPi is "pi." So, why am I seeing this 403 Error?
-
If you put the SD card back in the original Pi, does it still work there?– BrickCommented Nov 30, 2017 at 16:03
-
@Brick Yes, it does.– ThNCommented Nov 30, 2017 at 16:06
-
I've read about cases where SD cards are not fully transferable because some piece of software configures with the MAC address of specific hardware on a specific Pi. It's not clear to me what about Apache or PHP would have done that in your case though. To be clear, when this happens it's not because the SD card is not transferable per se, but because some piece of software on the card by the software's design is checking the hardware configuration of its host.– BrickCommented Nov 30, 2017 at 16:34
1 Answer
I suspect you may have an IP address issue. The default configuration for Raspberry Pis (and most computers and laptops as well) is to have a dynamic IP, meaning the device will get assigned an IP by the DHCP server (likely your home router). In order to avoid devices jumping form IP to IP every time they reboot, routers tend to "lease" an IP for a specific MAC address for 24 hours at a time.
Although both Pis are using the exact same SD card, they will have different MAC addresses, therefore, they will be assigned different IP addresses by the DHCP server. A simple and quick fix is to change your IP configuration from "dynamic" to "static" and manually assign an IP address to your Pi. This is done on the SD card directly, just pick an IP address that is in the same subnet as the rest of your network, but outside your DHCP range.
Instructions on how to do this will vary depending on which specific version of Raspbian you are using.