Mahngiel Posted September 5, 2012 Share Posted September 5, 2012 Ok, this is awkward. I compiled my version of 5.4.6 on this test partition, and hadn't had any errors until a few minutes ago when I came across this error. Now, according to the manual, you've had to explicitly --disable-ctype since like... 4.3. Also, according to the docs, there is no runtime config setting for this. So... dufuq? and how do i fix it? Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/ Share on other sites More sharing options...
Mahngiel Posted September 6, 2012 Author Share Posted September 6, 2012 thanks for the move, thorpe. sorry bout that. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375625 Share on other sites More sharing options...
requinix Posted September 6, 2012 Share Posted September 6, 2012 phpinfo? Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375629 Share on other sites More sharing options...
PFMaBiSmAd Posted September 6, 2012 Share Posted September 6, 2012 Are you sure about the code/exact error message? Perhaps you have a typo in the function name. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375630 Share on other sites More sharing options...
Mahngiel Posted September 6, 2012 Author Share Posted September 6, 2012 phpinfo? Are you sure about the code/exact error message? Perhaps you have a typo in the function name. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375633 Share on other sites More sharing options...
requinix Posted September 6, 2012 Share Posted September 6, 2012 Namespaces? For kicks try calling \ctype_digit. And then see if the other functions called below work. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375635 Share on other sites More sharing options...
Christian F. Posted September 6, 2012 Share Posted September 6, 2012 Actually, I think the problem lies with the PHP CLI parser, and not namespaces. I noticed that you took the phpinfo () dump from a web page, and thus went via the browser (and by extension the CGI executable). Then tried running the code via the CLI executable, and getting the error. I Just did something similar, with json_encode (): php > var_dump (json_encode ($test)); PHP Fatal error: Call to undefined function json_encode() in php shell code on line 1 However, when I saved it to a file, and ran it via the web server, everything worked just fine. So check what phpinfo () states for the CLI version, and I think you'll be enlightened. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375674 Share on other sites More sharing options...
Mahngiel Posted September 6, 2012 Author Share Posted September 6, 2012 I quite think you're onto something, @CF. I ran a dumped a test.php file and there's zero mention of ctype being in there. Now, as seeing as the browser version told me it was enabled, I'm not sure if it was disabled would there be an entry stating thusly or not. Here's a bit of cli mahngiel@studio46 ~ $ php test.php > output.txt mahngiel@studio46 ~ $ cat output.txt | grep 'ctype' mahngiel@studio46 ~ $ cat output.txt phpinfo() PHP Version => 5.4.6 System => Linux studio46 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 Build Date => Aug 29 2012 15:37:55 Configure Command => './configure' '--disable-debug' '--enable-inline-optimization' '--disable-all' '--enable-hash' '--with-pear' '--with-apxs2=/home/apache2.4/bin/apxs' '--with-layout=GNU' '--enable-filter' '--with-pcre-regex' '--with-zlib' '--enable-xmlwriter' '--with-openssl' '--enable-pdo' '--with-pdo-sqlite' '--with-readline' '--with-sqlite3' '--with-iconv' '--disable-phar' '--with-libedit' '--enable-exif' '--with-bz2' '--with-gettext' '--with-mcrypt' '--with-mhash' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib-dir' '--with-xsl' '--with-tidy' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-mbstring' '--enable-sockets' '--enable-dom' '--enable-xml' '--enable-soap' '--enable-libxml' '--enable-session' '--enable-simplexml' '--with-kerberos' '--with-curl' '--with-mysql-sock' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-config-file-path=/home/php5.4' Now, at this point I'm not sure if I need to recompile or what. That function is pretty important to my cron jobs, so I've temporarily replaced ctype_digit() with is_numeric(). What should I do at this point? Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375679 Share on other sites More sharing options...
Christian F. Posted September 6, 2012 Share Posted September 6, 2012 It's this part that's messing up for you: '--disable-all' So if you really need the ctype functions, you have a few options available: Recompile PHP-CLI, with --enable-ctype in addition to the flags listed above. Write your own validation functions, and use them instead. Run the script via the local web-server. Last option being a lazy hack, but.. Quote Link to comment https://forums.phpfreaks.com/topic/268042-undefined-function-ctype_digit/#findComment-1375681 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.