Question

i have a developpement server in witch the captcha works correctly, but not in production server. i take a look at phpinfo(), and GD is enable on both servers(ubuntu). so i don't understand what is the issue... here is my code:

$vals = array(
                'word' => $this->random_word(6),
                'img_path' => '/var/www/mysite/static/',
                'img_url' => base_url().'static/',
                'font_path'  => '/var/www/mysite/fonts/font.TTF',
                'img_width' => '150',
                'img_height' => '30',
                'expiration' => 7200,
                'word_length' => 6
                );

        $captcha = create_captcha($vals);

when i try:

var_dump($captcha);

the result is:

bool(false)

Any idea? Thank you

Was it helpful?

Solution

Make sure that the img_path is writable by the web server process on the server.

OTHER TIPS

Your image_path and font_path will be relative to that new server like

'img_path' => 'new_server_path/mysite/static/',
'img_url' => base_url().'static/',
'font_path'  => 'new_server_path/mysite/fonts/font.TTF',

And make sure that those folders will have both read and write permissions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top