You have PHP code now that sends data in a format that the Arduino understands. You need to expand on what the Arduino understands.
if (msg[6]=='#') {
switch(msg[5]) {
case 'R':
// Se receber o comando 'R#' envia de volta o status dos
// dispositivos. (Que é a string 'Luz')
client.write(Luz);
break;
You might have 4 more letters that correspond to the 4 octets of the IP address. Match the write-to-EEPROM code to the correct letter. 6 additional letters for the MAC address parts would work, too.
Of course, turning the whole protocol around so that the command comes first, followed by a variable number of values would let you use use two more commands (I and M, perhaps).