首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >验证码在我的CentOS服务器上不工作

验证码在我的CentOS服务器上不工作
EN

Stack Overflow用户
提问于 2014-12-28 00:23:26
回答 1查看 663关注 0票数 0

我在我的注册表上使用验证码.....代码本身是好的。我已经在几个服务器上使用了它,今天我重新测试了jsut来制作sure.....but,我有这一个服务器,除了验证码不想出现之外,一切都运行得很好……PHP:5.5.11操作系统: CentOS (5.11)我认为这是与服务器相关的问题,有什么想法吗?我以为问题出在GD图书馆...但它们也显示为已安装且运行正常。

代码语言:javascript
复制
<?php
// Set the header
header("Content-type: image/jpeg");

// Start the session
session_start(); 

// Generate the 5 digits string
$text = rand(10000,99999); 

// Store the generated code into the _SESSION captcha
$_SESSION['captcha'] = $text;

// Define the Image Height & Width
$width = 75;
$height = 37;  

// Create the Image
$image = imagecreate($width, $height); 

// Set the background color
//$black = imagecolorallocate($image, 88, 180, 22);
//$black = imagecolorallocate($image, 233, 98, 67);
    $black = imagecolorallocate($image, 68, 138, 191);
// Set the text color
$white = imagecolorallocate($image, 255, 255, 255);

// Set the font size
$font_size = rand(); 

// Generate noise
// for($noise = 0; $noise <= 20; $noise++) {
    // $x = mt_rand(10, $width-10);
    // $y = mt_rand(10, $height-10);
    // imageline($image, $x, $y, $x, $y, $white);
// }

// Draw the string with the given coordinates
imagestring($image, $font_size, 15, 10, $text, $white);

imageline($image, 0, mt_rand(5, $height-5), $width, mt_rand(5, $height-5), $white);
imageline($image, mt_rand(10, $width-10), 0, 0, mt_rand(10, $width-10), $white);

// Output the $image, don't save the file name, set quality
imagejpeg($image, null, 100); 
?>
EN

回答 1

Stack Overflow用户

发布于 2014-12-31 02:11:02

原来是GD库,我不得不重新编译我的php

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27669147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档