WHM enable PHP PDO library - php

I just switched hosts from a shared to a vps host and I am configuring my WHM account. I want to be able to use the PHP PDO library. I know how to get to the apache update form and locate the pdo section. The only problem is that there are two options, a pdo check box that reads
Includes SQLite support. MySQL support is available. If you plan on installing or updating >PDO drivers (freetds, oracle, etc) via PECL you might want to skip this option as PECL will >install the version of PDO it has. This option will make the following changes to your >profile prior to the build:
Enables:
SQLite3
and a PDO_MYSQL box that reads
This option will make the following changes to your profile prior to the build:
Enables:
PDO
I do not know which option to choose.

The second one, the first is to enable SQLite; I'm guessing you wanna use MySQL ?

Related

Installing MySQLi shows it will disable MySQL will it affect my current code?

I am trying to install mysqli extension on my server(CENTOS) using WHM Easy Apache 3.
I am selecting mysqli from Exhaustive Options List.
When I select mysqli extension it shows message that this action will disable current mysql extension.
Now, my problem is whether this action will affect my current websites code which is already using mysql extension. I have multiple websites on this server all are built using mysql extension.
I need mysqli for my new website of opencart.
Please help me to understand this warning also let me know if mysql is disabled then can I enable it again and how? so that I can use both mysql & mysqli extensions and my old work will not be affected by this change.
Actually I was in a bit of a hurry, so I took risk to build apache and php using easyapache3 and guess what.... my current code with mysql is not affected at all and both mysql and mysqli extensions are working fine, though I will not recommend to use mysql further to any one, but now I have a time to upgrade my old sites to mysqli and also I am able to use mysqli immediately for my new projects.
Note : when you build apache and php your php.ini might be rewritten by new default settings, so if you have any custom settings in php.ini remember to backup it first and then build apache.
Thanks a lot...

What's the difference between php_pdo_pgsql and php_pgsql PHP extensions?

My default php.ini file lists both extensions (installed via brew), and I sometimes see different variations on Linux (AMZN vs Centos) with the _pdo_ bit. What is the difference?
Update: I was getting errors saying pg_connect not found and this seems to be part of the non-PDO version. To get this installed on Mac via brew, I needed to add support by running brew reinstall php56 --with-postgresql
PDO is short for PHP Data Objects and is an abstraction that can be mapped on to a lot of different databases. This means you can move between things like MySQL, PGSQL and SQLite very easily. The PDO module enables the functions you see here for PGSQL.
The non-PDO module is specific to Postgres and will enable this set of non-standardized functions that will only work with Postgres databases.
The PDO extension can connect to different database management systems with the same syntax, as long as there's a driver for the system you want to use. The PostgreSQL extension can only connecto to PostgreSQL.
What you see is the PostgreSQL extension and the PDO driver for PostgreSQL.

Can phpmyadmin use pdo_mysql to access mysql?

My php installed with pdo_mysql, without mysqli/mysql. When I use phpMyAdmin, it showed
"The mysqli|mysql extension is missing".
I tried many times to install mysqli/mysql but failed, and I don't want to re-compile php. So I gave up and chose another mysql web tool Adminer which can use pdo_mysql.
Question : Is it possible that phpMyAdmin use pdo_mysql to access mysql db? I think it should be not hard ,since another tool can.
This information is not immediately available in the online documentation, but the FAQ has it:
phpMyAdmin can connect to your MySQL server using PHP’s classic MySQL extension as well as the improved MySQL extension (MySQLi)
The phrasing is more explicit in their Wiki:
[Requirements]
(...)
Either the mysql or mysqli extensions
(...)
So the answer is: not by default, but contributions are welcome :)

CakePHP Class 'PDO' not found

I have shifted my CakePHP (2.3.1 stable version) site to Host-ed.me and I am getting PDO class not found error. How to enble PDO on Host-ed.me server. Any suggestion is highly appreciated.
I suggest to first compare your previous/local PHP configuration with the configuration on hosted.me.
You can do so by generating a phpinfo() report of both. be sure to remove the phpinfo page afterwards - having a publicly visible phpinfo page on your website is a major security risk.
Check if PDO is really not installed on the webserver, either via the phpinfo() report or via instructions found in this question; How to determine if PDO is enabled in PHP?
You may also check if hosted.me is not using an outdated version of php, otherwise you may run into other problems later on
If PDO is not installed and is required for your website (or the php version is too old), there's no other option than to contact the hosting provider and ask them if it is possible to have it installed or your website be hosted on a different server.
Finally, if these options do not give you a solution, find a better hosting provider that does have a decent PHP installation :)
Check out this blog for details.
Basically, you have to do the folllowing:
1. Check if PDO is installed (lookinto your phpinfo() output / write simple program)
2. Install PDO, using yum install php-pdo
Test again, using the above scripts and you should be good to go.
You just need to enable the PHP extensions:
pdo
pdo_sqlite
sqlite
or ask host to enable them

mysql_connect() error message

I have installed Apache2.2 and then installed PHP5.4.8. I cannot get my new .php file to load in a browser because it keeps giving me the error Fatal error: Call to undefined function mysql_connect(). When I load the test.php file which has only this in it:
<?php phpinfo(); ?> it returns a page that shows information about PHP but where it would show the MySQL modules it only shows mysqlnd. What is that? Also, I have gone through the php.ini file and uncommented the proper lines for MySQL integration as well as having edited the Apache2.2 httpd file. Does anyone have any answers as to why MySQL isn't working? Thanks in advance.
Also, Ive tried many of the solutions from this website as well as many google searches. I can't seem to figure it out. :-(
1) Have a look on choosing MySQL API. It is recommended to use mysqli extension.
2) According to Other changes to extensions, the MySQL extensions mysql, mysqli and PDO_mysql use mysqlnd as the default library now.
A quote from MySQL Native Driver - mysqlnd site:
Although MySQL Native Driver is written as a PHP extension, it is important to note that it does not provide a new API to the PHP programmer. The programmer APIs for MySQL database connectivity are provided by the MySQL extension, mysqli and PDO MYSQL. These extensions can now use the services of MySQL Native Driver to communicate with the MySQL Server. Therefore, you should not think of MySQL Native Driver as an API.
That means, the mysqlnd extension does not export any function you can use in your scripts, but acts as a bridge between your code and one of mysql, mysqli, pdo_mysql extensions.
You mentioned, that phpinfo() shows only mysqlnd. The fact you don't see section titled MySQL there means that mysql extension is not enabled (commented out) in php.ini (Windows) or your php is not compiled with mysql support (Linux). More details about installing MySQL extension are here.
What is your OS?
To have a successfull MySQL connection you should:
Install the MySQL Server
Configure the PHP to use the proper mysql socket: (in php.ini search for mysql.default_socket - point it to the mysql server).
Reboot the web server - Apache

Categories