$link=mysql_connect("localhost", "root","parola") or die("Could not connect: " . mysql_error());
print ("Connected successfully");print "</br>";
mysql_select_db('energiesolara',$link) or die ('Can\'t use energiesolaradb: ' . mysql_error());
$x=mysql_query("SELECT umiditate FROM parametrii");
$y=mysql_query("SELECT temperatura FROM parametrii");
$info1 = mysql_fetch_array($x);
$info2 = mysql_fetch_array($y);
$graph=new PHPGraphLib(500,280);
$graph->setLegendTitle('Module-1', 'Module-2');
$graph->setGradient('green', 'olive');

I have this error :(

Connected successfully

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\charty.php:3) in C:\xampp\xampp\htdocs\phpgraphlib.php on line 163

Make sure there is no space before <?php and after ?> too

That's because the graph class you use to output the image is trying to set some image headers, but you already outputed some stuff (from your print commands) before it, which php don't allow.
1. This should fix your error: remove all the prints before phpgraphlib.php; leave only the error dies (if the script dies, it won't get to the graph lib anyway)
2. Just an improvement: select both mysql values in a single select:

$result = mysql_query("SELECT umiditate, temperatura FROM parametrii");
$info = mysql_fetch_array($result);

remember there can be nothing sent to the browser before your php codes.
sometimes if your using mysql you need sessions which should always start at the top. i had this problem a while ago and this fixed my problem.

if (!isset($_SESSION)) {


as an added note you dont need the require because your password and connection details are in your page. i just use it for security