Can I sign a text with a Bitcoin address using PHP only?
A bit late but I created a PHP library for cryptocurrency. You can use this library to achieve what you want.

You can use it like this:

require('CryptoPHP.php');
$wif_key = 'Kzy3fea4xCwLczAj3g8TYvDw6QRKCMqvVZX2J7vaXgy78VhieRdV'; //this is your wif key
$private_key = $this -&gt; wif2key($wif_key); //get the wif key to a hex private key
$hash = 'Just a sample text'; //this is what you're trying to sign.

$signature = $this -&gt; sign($hash,$private_key);