0

I have added the following php.ini (this is 100% of file):

upload_max_filesize = 200M
post_max_size = 200M
session.gc_maxlifetime = 6000
max_execution_time = 600

When it is present the phpinfo() lists PDO in the configure command but nowhere else. The drivers, API version and SQLite version are all gone. I discovered this when queries started failing with "Class 'PDO' not found".

If I remove the php.ini I get different results, see below. This is on a shared server. How should I proceed? I absolutely must have the php.ini modifications.

PDO settings

jerrygarciuh
  • 21,158
  • 26
  • 82
  • 139
  • try setting them in your php script with `ini_set` http://php.net/manual/en/function.ini-set.php instead. This way you won't override the whole default `php.ini` file – CrayonViolent Dec 05 '13 at 01:07
  • 2
    well, looking at the list here: http://www.php.net/manual/en/ini.list.php looks like you can set all of those except `post_max_size` within your script, so you're going to have to contact your hosting provider about editing/appending to `php.ini` instead of overwriting it – CrayonViolent Dec 05 '13 at 01:13
  • 1
    May i'm not understanding correctly but (this is 100% of file) means you only have those four options set in the php.ini file? If so you must add extension=* and so on. –  Dec 05 '13 at 01:52
  • Check your control panel and see if you can edit/download the current php.ini and just change the values you need. –  Dec 05 '13 at 01:59
  • @DBPBTPV - But when you add a local php.ini it doesn't replace the main one it is just an additional ini parsed and only overwrites the provided values or so I always thought... – jerrygarciuh Dec 05 '13 at 02:07
  • 1
    in phpinfo() search for the variable "Loaded Configuration File" and if there is just the file you uploaded it means that is using only those variables and there aren't additional ini files loaded. try adding extension=pdo.so and see what happens. –  Dec 05 '13 at 02:26
  • Thanks. Added extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.so and this resolved. I guess I'll have to add everything more or less from host's ini file. Want to add your comment as the answer? – jerrygarciuh Dec 05 '13 at 03:35

3 Answers3

3

If your ini file only contains those vars it will only override them and use the master values for the others but in most cases extensions like pdo, mysqli, mbstring, sqlite are disabled by default to save resources and most shared hostings nowadays let you enable them.

2

I had the same problem. My solution was that in php.ini the line dictating the loadable extensions folder was incorrect.

I changed:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/home/mycmecre/public_html/php_extensions"
;extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"

to

; Directory in which the loadable extensions (modules) reside.
;extension_dir = "/home/mycmecre/public_html/php_extensions"
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"

and PDO magically loaded for me. Hope this helps someone, as it took me hours to figure out, and apparently longer for my web host tech support, as they have not called me back yet.

Zac Imboden
  • 751
  • 8
  • 11
1

It would appear that leaving out an extension in the php.ini, such as PDO, results in the extension becoming disabled.

I would suggest you grab a sample/default php.ini file and add your modifications. Here is a previous SO post about sample php.inis, https://stackoverflow.com/a/9602645/1349295.

Community
  • 1
  • 1
Czar Pino
  • 6,258
  • 6
  • 35
  • 60