I am trying to compile pdo.so and pdo_mysql.so to get pdo support on my PHP5 install.
I tried the following :
./configure --prefix=/thedirectory --with-mysql --with-pdo-mysql --enable-pdo
Compilation is successful but the .so aren't generated.
I am supposed to have/specify a mysql installation?
Is the pdo support supposed to be compiled within php core ?
If I run a php -m I can see PDO and pdo_mysql registered, but a phpinfo() states no pdo_mysql support.
I guess the php -m just tells me php has pdo support but still need the .so?
Could anyone advise?
Thanks
Use the following configure options:
./configure \
--with-mysqli=/home/user/programs/mysql/install/bin/mysql_config \
--with-pdo-mysql=/home/user/programs/mysql/install
The /home/user/programs/mysql/install directory is where MySQL has been installed.
You should see a pdo_mysql section in the phpinfo() output showing the following:
PDO Driver for MySQL enabled
Client API version 5.7.16
The latest versions of PHP come with PDO drivers for MySQL, Oracle, PgSQL, ODBC, SQLite and Firebird/Interbase. All you have to do is enable them in your php.ini:
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
Here I have MySQL, and PgSQL enabled while all others are disabled.
(This is from a php.ini file from Windows, but on linux it looks pretty much the same, just the extensions are in the form of pdo_mysql.so, pdo_pgsql.so, etc.)
Related
I've been trying to add the Firebird extension to PDO with no luck. I have a RHEL7 server, I ran ./configure --with-firebird successfully, ran the make command, and make install successfully.
If I type
php -i | grep PDO
I get the following:
PDO
PDO support => enabled
PDO drivers => firebird, sqlite
PDO_Firebird
PDO Driver for Firebird/InterBase => enabled
PDO Driver for SQLite 3.x => enabled
However, when going to my site's phptest.php file it only shows
mysql
sqlite
I guess I'm missing one last step, but I don't know what.
Try running slightly different command
./configure --with-firebird --with-pdo-firebird
Then find phph.ini (or the file that acts like that in Linux platform) and enable (de-comment?) the line like extension=php_pdo_firebird.dll ( in Linux it probably would be like libphp_pdo_firebird.so or something, see for the specific files your building process generate).
See also:
http://php.net/manual/en/ref.pdo-firebird.php
Enable PHP Firebird connection
I have just started learning PHP and Mysql and I have a problem when I run php file.
error :could not find driver
This is version that I am using:
I tried to follow answers of question that similar but still can not solve the problem.
It appears you have a simple typographical error in your code. You defined your DSN with the string msql:dbhost=localhost...
But you should use mysql:dbhost=localhost...
See http://php.net/manual/en/ref.pdo-mysql.connection.php for reference docs on the MySQL DSN format.
You have installed php-pdo but you might also need either php-mysql or php-mysqlnd (prefer the latter).
You can check by running php -i | less to give a lengthy report of all the extensions currently installed. Look for the "PDO" section, and confirm that the mysql driver is among the drivers installed:
PDO
PDO support => enabled
PDO drivers => sqlite, mysql, sqlite2
If it does, it should be followed by a "pdo_mysql" section. Mine looks like this:
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $
Directive => Local Value => Master Value
pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock
If you don't have the pdo_mysql section, you should install the corresponding yum package for it:
sudo yum install php-mysqlnd
I've added the following lines in php.ini
extension=pdo.so
extension=mysql.so
extension=pdo_mysql.so
But I'm still only getting sqlite support in phpinfo(); and a PHP app I'm trying to install shows "PHP PDO MySQL Module: Not Found".
however php -m gives the following list:
bcmath
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib
As it turns out the php-mysql package was an error state, I followed the instructions in another answer to resolve it
php-mysql version conflicts with Mysql server
if using windows just uncomment
extension_dir = "ext"
in php.ini
You have an CentOS(Red Hat(Linux)). You need to install the php_module like that:
sudo apt-get install php5-mysql
Then do an apache restart Like that:
sudo service apache2 restart
After compiling php 5.3.28 on CentOS 7 I saw that pdo_mysql is missed and I need to make another compile with pdo_mysql.
After the second compile, pdo_mysql is only available when I am executing php script from command line not from Apache.
I tried to enable the pdo_mysql.so extension in php.ini but nothing changed.
Do you know how to make pdo_mysql to be enabled when I am executing php scripts over apache (Apache 2.4.6)?
If this is a box for testing, I would suggest the following.
First, build CentOS 6. There's a LOT more support out there for that as opposed to 7.
Second, you CAN install libxml2 2.9.1 on EL6. It's just not an official build
Third, I would look into Atomic Nucleus and see if they'd let you install it for free. It's a 5.3 repo and should have what you need.
When I try to run a PHP scripts I get the following errors:
Warning: PHP Startup: Unable to load dynamic library '/home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so' - /home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so: cannot open shared object file: No such file or directory in Unknown on line 0
php.ini:
extension_dir = "/home/user/php-5.4.28/installdir/include/php/ext"
Content at extension_dir path:
~/php-5.4.28/installdir/include/php/ext$ ls
date ereg gd iconv libxml mysqli pcre session sqlite3 xml
dom filter hash json mbstring mysqlnd pdo spl standard
Where do I locate the extension?
I have installed PHP from source.
All the errors and phpinfo() can be seen here on JSBin
You don't have to locate the extension. You have to recompile PHP passing the option --with-bz2 to the ./configure script. Bzip2 support is not enabled by default as official documentation says.
./configure --with-bz2
Keep in mind that in order to compile PHP with this extension you need development headers and/or libraries. If they are missing ./configure will fail saying what's missing. If this will happen simply use your package manager (apt, yum or zypper - distro dependent) to install required packages and retry.
It's also likely that your PHP apps are using other extensions. The procedure is exactly the same. You just add more options. Let's say that curl is also needed, then:
./configure --with-bz2 --with-curl
will work - again more headers and packages needed.
Remember to always use all the options you need as the results of former compilations are overwritten.