ETHERNET SHIELD RFID PROBLEM

leopena_94:
SPI.begin();
Ethernet.begin(mac, ip, gateway, subnet);

If I initialize the SPI first before the ethernet. the RFID works while the Ethernet shield does not

On the other hand,
Ethernet.begin(mac, ip, gateway, subnet);
SPI.begin();

If I do it this way ethernet works while the RFID does not.

OK. IF RFID works and does exactly what you want (forgetting all the PHP stuff), then there is clearly nothing wrong with it, you DO know what bus it uses, and the code relevant to it is kosher. That's a good start

AND it appears you have Ethernet working and, by itself, it does exactly what you want.

I have never experienced your problem, but it sounds like you have pin conflict.

I ASSUME both devices are SPI, with W5100 using the ICSP cluster and RFID on SPI pins 50,51,52, and can only guess you have a pin conflict with SS. A further guess is that RFID SS is on pin 53, which is in fact common with the SS on the ICSP cluster. Since you have no choice about the ICSP cluster, this means you have to relocate the SS off pin 53, and adjust the code. (a guess)
Hope that helps!