I want to work with PDO, through PHP command line.
It works perfect through the PHP web API, but not through the command line.
But when I execute the command: php test.php, it says unknown class PDO.
I think it has something to do with the thread-safety difference.
Because, when I execute the above command, the following warnings come: -
F:\shema\htdocs>php test.php
PHP Warning: PHP Startup: soap: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: sockets: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
PHP Fatal error: Class 'PDO' not found in F:\shema\htdocs\test.php on line 2
PHP version: 5.2.9-2, downloaded from
here.
OS: Windows Vista
If the problem is with the modules, where do I get the thread safe modules for those modules?
Your PHP and your modules were compiled with different thread-safety (turned "on" in PHP, turned "off" in the modules). Grab the correct non-thread-safe (or "nts") build of PHP to match the modules you're trying to use and your problem should clear up.
Ah, you see
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=1
Thread safety mismatch. You need to get the ones with thread safety turned on.
You have an error defining extension_dir in your php.ini. Try to put there absolute path.
Related
I need to install SSH2 to my PHP5.6. So as I read this accepted answer I downloaded zip from here then coppied php_ssh2.dll and php_ssh2.pdb to php/ext and libssh2.dll to Windows/system32. And after Apache restart and SSH2 call it throws me this error:
PHP Warning: PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
Warning: PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
How can I solve it? Thanks you.
I ran the command php –I and I received the following warning:
Warning: PHP Startup: ▒=!: Unable to initialize module
Module compiled with module API=20020429, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
As you can see it doesn't give me the module name, how can I discover the module name?
Modules installed
-bash-3.2$ php -m
Warning: PHP Startup: ▒=!: Unable to initialize module
Module compiled with module API=20020429, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
[PHP Modules]
ctype
curl
date
dom
filter
gd
hash
iconv
json
ldap
libxml
mcrypt
mhash
mysql
oci8
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
As you can see from running the php -m I get the error again, but no insight to what module it might be.
Whenever I try to run a PHP script on the command line, it crashes imediately. I get this errors:
Xdebug requires Zend Engine API version 220090626.
The Zend Engine API version 220100525 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.
Warning: PHP Startup: imap: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: gettext: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: yaz: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: pgsql: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Warning: PHP Startup: uploadprogress: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
Fatal error: Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0
This is the PHP part of my .profile.
# make sure we use MAMP version of php and other binaries
export PATH=/Applications/MAMP/bin/php/php5.3.14/bin/:$PATH
# make sure we use MAMP version of mysql and other binaries
export PATH=/Applications/MAMP/Library/bin:$PATH
# make sure we are using the same php.ini as MAMP PRO
export PHPRC='/Library/Application Support/appsolute/MAMP PRO/conf/php.ini'
# make brew doctor happy
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
This has been working for months without problems. But leatly I updated to Maverik and had to update XCode and lots of homebrew stuff. After all I thought all my PHP stuff is comming from MAMP and should not be related to this.
Any ideas?
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I just updated PHP 5.2.0 to 5.2.11 and now I am getting loads of errors when calling PHP :(
I downloaded source and used the same ./configure line from old phpinfo then did make install.
The errors I'm getting are below, anyone have any ideas how to sort out this mess please?
This is on RHEL 5.2
PHP Warning: PHP Startup: dbase: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: dom: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: gd: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: imap: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: ldap: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mysqli: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: PDO: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: xmlreader: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: xmlrpc: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: xmlwriter: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/xsl.so' - /usr/lib/php/modules/xsl.so: undefined symbol: dom_node_class_entry in Unknown on line 0
Problem solved - just had to ditch a load of ini files in /etc/php.d
Maybe not the best solution, I'm not sure if I've now lost some functionality, but everything I need it to do works so it's fine.
I'm going to wager that those modules were installed via pecl, as opposed to compiling them along with php. Do you have options like --with-pdo, --with-pdo-mysql in your ./configure line? If not, then all this stuff could have been installed (which includes compilation and linking against PHP) via pecl after the initial PHP compile.
What happens if you upgrade each via pecl?
pecl upgrade <modulename>
I tried to find a simple way to upgrade PHP on my CentOS5 machine using yum instead of downloading the source and compiling it again myself (I did it last time, but it's really difficult to get all the compile configurations same as CentOS's default). Anyway, I finally use the methods listed here:
http://www.atomicorp.com/wiki/index.php/PHP
Now, the command php -v shows the version is already 5.2.11 (which I needed) , but it always contains many warnings like:
PHP Warning: PHP Startup: fileinfo: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: mssql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
I think it basically means that I need to recompile these four modules, how could I do that? Any suggestions are appreciated.
This is really easy, you need to add more upto date yum repository and then upgrade.
one example is here.
cat >> /etc/yum.repos.d/utterramblings.repo <<END
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL5/i386/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
After this you would get latest versions of php and other extensions. It works!!
PHP is not installed all at once, it's modular. So you have things just like you listed that are designed for a different version of PHP. You will need to install all the plugins you are using for your implementation for the version of PHP you have installed.
Short answer, if you want a REALLY up to date PHP version, don't use CentOS. It's just a pain. CentOS is about stability, not cutting edge software. Use Ubuntu or Debian.
Long answer, your best option hands down is to compile from source or to find a repository that provides PHP 5.1.whatyouneed. I would advise against using a repository unless you are VERY sure that it comes from a reputable source.
If I was to do this I'd compile PHP from the source. Here is a link to get you started: http://www.wolflabs.org/2008/12/08/installing-php-from-source-on-centos-x86_64-w-apache/
You should grab the SRPM, replace the tarball, and rebuild it. You may want to grab the "extras" SRPM as well if you need anything from it.
here is repo configuration I've used to upgrade PHP on CentOS 5 (look for Enterprise Linux 5 in the text)
http://blog.famillecollet.com/pages/Config-en
Try
pecl install fileinfo readline memcache
And this should fix the problem.
pecl install memcache
Worked for me running Centos 5.5
I followed a CentOS wiki on how to upgrade PHP using a testing repository:
http://wiki.centos.org/HowTos/PHP_5.1_To_5.2
I was getting errors for fileinfo and memcache, so I tried:
pecl install fileinfo memcache
...and all of the warnings vanished.