MAMP: How to upgrade PEAR - macos

When trying to upgrade MAMP pear the following error is raised:
Notice: unserialize(): Error at offset 276 of 1133 bytes in Config.php on line 1050
ERROR: The default config file is not a valid config file or is corrupted.
Some suggestions how to fix this?
Steps to reproduce:
Installed MAMP (version 2.0.5)
cd /Applications/MAMP/bin/php/php5.3.6/bin
sudo ./pear upgrade pear
above mentioned error is thrown
Update (1):
Based on answer 8375349/420953 I tried 2 possibilities to fix this
A: delete pear.conf
rm /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
B: edit pear.conf
change "php_dir";s:44 to "php_dir";s:43
both resulted in error:
Could not get contents of package "/Applications/MAMP/bin/php/php5.3.6/bin/pear". Invalid tgz file.
upgrade failed
Update (2):
running
which pear
results in output
/usr/local/bin/pear
With this, I noticed that I was using the "local" version of PEAR.
I removed it with
sudo pear uninstall pear
and then tried to upgrade the MAMP version of PEAR with
/Applications/MAMP/bin/php/php5.3.6/bin/pear upgrade pear
this results in error
Cannot install, php_dir for channel "pear.php.net" is not writeable by the current user
upgrading with
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear upgrade pear
installs it locally (again).
running
which pear
outputs
/usr/local/bin/pear
this brings me back to the starting point of Update (2). Seems that I am not able to upgrade PEAR under a MAMP directory.
Update (3):
I posted question
MAMP PEAR configuration is pointing to local directories
because my assumption is that the root of this issue is related to MAMP PEAR config.
Update (4):
I did not install a local PEAR version and this was causing quite some issues. After also installing a local version (and not only the MAMP) version, upgarding the MAMP version worked perfectly.

People with the your exact problem seem to has solved it in this MAMP forum thread.
You can either delete /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf, or change a line in that file from "php_dir";s:44 to "php_dir";s:43.

Edit the pear.conf: Adding a forward slash "/" to the end of the php_dir path, while keeping the s:44 solved the problem for me and a couple coworkers.

I have XAMPP installed, and I just deleted /xampp/php/pear.ini and that solved the same problem

Just chipping in with a late response for others finding this answer. My PEAR config had several issues and not just the php_dir config setting.
I had to go over all of my settings to verify that the count was correct. When all errors where fixed my PEAR was working fine again.
Seeing this message in the terminal:
Notice: unserialize(): Error at offset 276 of 1133 bytes in Config.php on line 1050
ERROR: The default config file is not a valid config file or is corrupted.
Go to your PEAR Config file (probably located here /MAMP/bin/php/php7.0.10/conf/pear.conf)
Go to the 276th character in that file and verify that the string length matches the s43 that's defined before the string.
Run a PEAR command again (e.g. pear version)
If you have more errors located at e.g. 317th character you count that string and write the length in the s:XX before the string.
Just for clarifying for others finding this issue. The PEAR Config file is a serialized object that is unserialized when running commands.
A serialized object looks like s:5:"value" with the s:5 defining the length the string.

Related

Python - cant find pip.ini or pip.conf in Windows

I got Python 2.7.8 installed on my Win7 machine, which comes with pip already pre-installed. I'm successfully able to install new packages from pip and now I need to add custom repository url to the install list of pip
To do so I need to modify pip.ini which is in %APPDATA%\pip\pip.ini according to the Official Manual
However there are no pip folder anywhere (not in Roaming, not in Local, not in LocalLow)
nor there exists PyPa folder in: C:\ProgramData\PyPA\pip\pip.conf
Could you tell me where do i search for pip.ini? how to add foreign repo to the install list?
Instead of checking a list of well-known locations, you can ask pip to list the valid locations:
pip config -v list
Fun fact
On the same machine, with the same pip version, the valid locations can vary based on the actual Python version.
Environment: Win 7 x64, the HOME environment variable is set to D:\Home
Python 3.7.3:
> pip config -v list
For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini'
For variant 'user', will try loading 'D:\Home\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\foobar\AppData\Roaming\pip\pip.ini'
For variant 'site', will try loading 'C:\Python37\pip.ini'
Python 3.8.0:
> pip config -v list
For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\foobar\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\foobar\AppData\Roaming\pip\pip.ini'
For variant 'site', will try loading 'C:\Python38\pip.ini'
Finally got it sorted.
Apparently for Windows users pip.ini config file is not created, however can be added manually!
just create new %APPDATA%\pip\pip.ini and content of custom repository:
[install]
find-links = https://<login>:<password>#your.repo.com/custom/url
Reference: https://pip.pypa.io/en/stable/user_guide/#config-file
A bit late, but for reference:
Try adding the pip.ini file in %USERPROFILE%\pip\pip.ini (usually: C:\Users\<username>\pip\pip.ini).
On windows pip.exe looks for "pip.ini" in this order:
C:\ProgramData\pip\pip.ini
C:\Users\<username>\pip\pip.ini
C:\Users\<username>\AppData\Roaming\pip\pip.ini
It's been 7 years, and I think there's now a better answer for most people -- but it does depend on version of pip. For the most recent pips I'm using:
$ pip config -v debug
lists where it's looking and you can decide which location is
most useful for what you've got in mind. It does look like a fairly recent
change: On a year-old docker image I had with pip 20.1
I got "ERROR: Need an action (edit, get, list, set, unset) to
perform." On that system, pip config -v list gave a list of files it would try, this is supposed to be 'global', 'user' or 'site' variants of pip.ini locations.
For Windows 10, for pip 21.2.4 on both 3.9.6 and 3.6.8, I get response below with pip config -v debug, while pip config -v list is silent (unless a pip.ini is found).
global:
C:\ProgramData\pip\pip.ini, exists: False
site:
c:\py\myvenv\pip.ini, exists: False
user:
C:\Users\myname\pip\pip.ini, exists: False
C:\Users\myname\AppData\Roaming\pip\pip.ini, exists: False
From a downloaded image I got from dockerhub in June 2021 with pip 21.2.2 and python 3.6.10:
pip config -v debug
env_var:
env:
global:
/etc/xdg/pip/pip.conf, exists: False
/etc/pip.conf, exists: True
global.extra-index-url: http://trynexs:8081/repository/repo_group/simple
site:
/usr/local/pip.conf, exists: False
user:
/home/tanhauser/.pip/pip.conf, exists: False
/home/tanhauser/.config/pip/pip.conf, exists: False
Pip changed the location of the config file in windows starting in pip 6.0 the pip config docs explain the location of the config files as follows.
pip --version >= 6 (as of version 18.1 hasn't changed again yet)
%APPDATA%\pip\pip.ini
pip --version < 6
%HOME%\pip\pip.ini
Inside a virtual env
%VIRTUAL_ENV%\pip.ini
Site-wide win7+ (same as of win10)
C:\ProgramData\pip\pip.ini
Site-wide winxp (note windows vista side wide not supported)
C:\Documents and Settings\All Users\Application Data\pip\pip.ini
NOTE: If multiple configuration files are found by pip then they are combined in the following order:
The site-wide file is read
The per-user file is read
The virtualenv-specific file is read
Also pip added a config command starting in pip 10.
pip config --help
I know this is a bit late, however, this post is high on the rankings when searching. Inside a virtual environment pip.ini can also be in the root of the virtual environment. From the docs and https://pip.pypa.io/en/stable/user_guide/?highlight=pip.ini#configuration
Inside a virtualenv:
On Unix and macOS the file is $VIRTUAL_ENV/pip.conf
On Windows the file is: %VIRTUAL_ENV%\pip.ini
All the answers are partially wrong and right.
It depends on how your system is configured. The only way (for me) to find out was to patch site-packages/pip/locations.py at the point where site_config_files is assigned (around line 120 for pip 9.0.1)
print('########## ' + str(site_config_files))
and then run pip search foo
On my system it printed ########## ['C:\\ProgramData\\pip\\pip.ini'], of which location I assumed I could not create/edit. But it just worked.
Btw, for my system %APPDATA% points to C:\Users\MYUSER\AppData\Roaming, which is not looked at when running pip on my system.
Rather than guessing first check if you have any default global/local config which is read by pip with the below command:
pip config list
This will give all details of the default config loaded by python.
If the above command doesn't give any output please try to find where pip tries to find for the global config file with the below command:
pip config --editor <path to editor of your choice> edit
The above command will open the config file which pip reads by default or else it will give an error saying that the file doesn't exist.
If there's an error please go ahead and create the exact directory and file structure as show in the error. Once the file has been created please make your changes e.g.
[global]
cert = /path/to/base64/ssl/certificate.pem
proxy = http://username:password#ipaddress:port
Save the file and please try to check (the above mentioned check command) if the configs are loaded by pip or not.
For more info please follow pip config documentation
Make sure you acually have a pip.ini file, not pip.ini.txt.
For me (Windows 8, pip 9.0.1, python 3.5.3), the correct path was
c:\Users\<UserName>\.pypirc <- sic!, even on windows
Windows 10:
I had to create 'pip' directory inside
C:\Users\UserName\AppData\Roaming\
then create pip.ini file inside that 'pip' directory:
C:\Users\<username>\AppData\Roaming\pip\pip.ini
No other location worked for me.
For Windows, python will load the config from path below. So, if pip.ini file is not exist in these paths you can create the new file by refer these path depend on environment scopes (global, user & site) that you need python execute.
For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\MyName\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\MyName\AppData\Roaming\pip\pip.ini'
For variant 'site', will try loading 'c:\python39-32\pip.ini'
By the way, you can check the paths as above by
pip config -v list
On a Windows 10 machine with multiple users I used this:
c:\users\all users\pip\pip.ini
Using pip version 22.3.1 with python version 3.10.4..

Error -60005 when install Cocos2d-iPhone v3 RC4

When I try to install Cocos2d-iphone 3.0.0 RC4, I got an error: (run without sudo)
Error -60005 occurred while executing script with privileges.
So, I try to show its package content and use terminal to do: cd ...Cocos2D Installer 3.0.0.app/Contents/MacOS
I try this command: (with sudo)
sudo ./Cocos2D\ Installer\ 3.0.0
It works but I got log with some errors:
[1m>>> Installing Cocos2D-v3.0.0 files (B[m
[1m>>> Installing Cocos2D-v3.0.0 templates (B[m
[4m[1mCocos2D Template Installer (Cocos2D-v3.0.0)(B[m
Error: [31m✖︎(B[m Script cannot be executed as root.
In order for it to work properly, please execute the script again without 'sudo'.
If you want to know more about how to use this script execute '/Users/viethung/Downloads/Cocos2D-v3.0.0/install.sh --help'.
[1m>>> Building/Installing Cocos2D-v3.0.0 documentation, this may take a minute.... (B[m
appledoc version: 2.2 (build 963)
Generation step 4/5 failed: GBDocSetInstallGenerator failed generating output, aborting!
Documentation set was installed, but couldn't reload documentation within Xcode.
Xcode got an error: No documentation set present at specified path.
[1m>>> Cocos2D-v3.0.0 installation complete! (B[m
Are there any way is better than this way?
I have same problem.
I think you installed old cocos2d-iphone and it caused this problem.
You should remove old cocos2d-iphone first. I removed:
~/Library/Developer/Xcode/cocos2d v3.x
And install again. It works for me.
Hope it works for you :)

PHPUnit instllation broken since Mountain Lion upgrade

I upgraded my Mac from Lion to Mountain Lion a few months ago.
I previously had PHPUnit working with my Zend Framework 1.11 without issue but had not used it much.
I now have Zend Framewoprk 2 running on a Quick Start website but I simply cannot gwet PHPUnit to work.
I've searched numerous questions related to this on Stackoverflow and tried reinstalls and path changes to php.ini without success.
I have also checked that my PEAR install is working fine, which it is but the error is the same when I try "phpunit --version"
PHP Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
PHP Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Attempts to reinstall phpunit results in me been told phpunit is already installed and its version current.
$ sudo pear install phpunit/PHPUnit
phpunit/PHPUnit is already installed and is the same as the released version 3.7.10
install failed
Trying to uninstall fails as phpunit is a dependancy in other items/applications.
Is there anyway I can fix this or completely remove it and reinstall fresh?
include_path in my php.ini is:
include_path=".:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear"
Additional info in case its relevant:
> which phpunit
/usr/bin/phpunit
> which pear
/Users/johnadmin/pear/bin/pear
> which php
/usr/bin/php
Autoload.php is located in
/Users/johnadmin/pear/share/pear/PHPUnit
Additionally, the folder '/usr/lib/php/' exists but the PHPUnit directory is not under that, it is under /Users/johnadmin/pear/share/pear/PHPUnit
bash_profile content/paths
PATH=$PATH:/usr/local/Cellar/imagick/3.0.1:/usr/local/sbin:/Users/johnadmin/pear/share/pear:$
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-04-17_at_08:37:29: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-10-09_at_16:09:32: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-12-06_at_13:40:25: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
At my wits end as I do not know what else to check frankly and any help would be a big help. Ta
John
Nevermind after hours of trying various solutions I found that creating a simlink to the PHPUnit folder worked.
Command I used was
sudo ln -s /Users/johnadmin/pear/share/pear/PHPUnit /usr/lib/php/PHPUnit
Seriously, this helped me a lot:
Install Composer (http://getcomposer.org)
composer require phpunit/phpunit 3.7.*
composer update
Three simple steps to pull PHPUnit source, and binary to your project.

Can't install PEAR on Windows 7, Structures/Graph error

I just did a clean install of Windows 7. I've installed Apache, Mysql
and PHP 5.3.5 all separated (not using XAMPP/others).
I'm getting the following error in the install: ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
The full stack trace is:
C:\Web\php-5.3.5>go-pear.bat
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : C:\Web\php-5.3.5
2. Temporary directory for processing : C:\Web\php-5.3.5\tmp
3. Temporary directory for downloads : C:\Web\php-5.3.5\tmp
4. Binaries directory : C:\Web\php-5.3.5
5. PHP code directory ($php_dir) : C:\Web\php-5.3.5\pear
6. Documentation directory : C:\Web\php-5.3.5\docs
7. Data directory : C:\Web\php-5.3.5\data
8. User-modifiable configuration files directory : C:\Web\php-5.3.5\cfg
9. Public Web Files directory : C:\Web\php-5.3.5\www
10. Tests directory : C:\Web\php-5.3.5\tests
11. Name of configuration file : C:\Web\php-5.3.5\pear.ini
12. Path to CLI php.exe : C:\Web\php-5.3.5
1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\Web\php-5.3.5\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.8.0.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.3
install ok: channel://pear.php.net/Console_Getopt-1.2.3
ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.8.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's' PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
** WARNING! Old version found at C:\Web\php-5.3.5, please remove it or be sure t
o use the new c:\web\php-5.3.5\pear.bat command
The 'pear' command is now at your service at c:\web\php-5.3.5\pear.bat
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\Web\php-5.3.5\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
C:\Web\php-5.3.5>
After days of googling I've found an answer. Here is it. How to solve:
With admin permission (start cmd with admin privileges):
Run the go-pear.bat that comes with the default PHP installation. It'll installs PEAR, but it's going to generate an error when installing Structures_Graph. IMO Pear needs this package to generate the package dependency (graph), since it's missing it not allow us to install or upgrade any other package.
Download and uncompress Structures_Graph from the pear.php.net website (direct link). Then copy the Structure folder into the PEAR folder. The archive has three folders: docs, Structures, tests. We only need the Structures one. Copy the Structures folder to your PHP_ROOT_DIRECTORY\PEAR directory. So if you installed PHP on C:\Web\php-5.3.5 copy the Structures folder to C:\Web\php-5.3.5\PEAR\, the result should be: C:\Web\php-5.3.5\PEAR\Structures
Do pear install Structures_Graph. Even though the files are present, Structures_Graph is not really installed (we had a problem during installation). So we need to run the command above.
Do pear upgrade PEAR. This upgrades PEAR itself to the current version.
Do pear upgrade Console_Getopt. This upgrades Console_Getopt to the current version and now we can manage and install any pear package.
Marcos Roriz solution does indeed work, but to clarify point 2:
The uncompressed "Structures" folder (inside the tgz) needs to be placed inside the folder: "PEAR\pear" -> e.g. C:\wamp\bin\php\php5.3.5\PEAR\pear
This is a combination of the things you need to do and a couple of new tweaks. Worked on WinXP Pro with WAMP (Wampserver 2.2.1)
Change your go-pear.bat file:
#ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.phar
pause
Run it - go-pear.bat
Now you've go a Pear install with a missing graph.php
Download and uncompress Structures_Graph from the pear.php.net website. Copy the Structure folder into the PEAR folder so that the key files are located as such:
PEAR\Structures\Graph.php
PEAR\Structures\Graph\Node.php
Change this line in Node.php:
require_once '/Structures/Graph.php';
Execute in the PEAR directory:
pear upgrade=all
That did it for me.
First of all, run as administrator.
Then - try to write something in target directory in the console to isolate any remaining permissions problems.
I've been having many issues after upgrading my wampserver which now comes with php 5.3.5.
I have solved the problem by installing php 5.3.0 alongside and using it to run the installer found at http://pear.php.net/go-pear. I set the php cli setting to the php5.3.5 folder without any issues.
This might be wampserver specific. To gauge if you are experiencing a similar problem here are some of the issues I encountered:
Using the go-pear.bat packaged with php5.3.5 i had the same unable to unpack error as the original poster.
Using the go-pear.bat packaged with php5.3.0 i was able to complete the installation but the pear installer was v1.8.0
Using the installer on the pear site mentioned previously with php5.3.5 i had an error "Warning: rmdir(D:\temp): Directory not empty in D:\go-pear.php on line 1237". Looking at the stack trace the Archive_Tar class was throwing an error and the installer was failing to clean up after itself.
the web frontend not write correct paths to pear.ini
ig phph setting is magic_quotes_gpc = On
its doubles all slashes "\" in paths to "\" is it a bug ?
Than the packages for example can be unpacked (wrong paths ?)
"unable to unpack" Message when installing packages
http://pear.php.net/bugs/bug.php?id=18212
I tried all of the above with no luck. After downloading and extracting the "Structures" folder I had to edit all paths and add "PEAR/". Then I was able to do "pear install Structures_Graph" and then "pear upgrade-all"
Graph.php
require_once 'PEAR/Structures/Graph/Node.php';
Node.php
require_once 'PEAR/Structures/Graph.php';
AcyclicTest.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
TopologicalSorter.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
require_once 'PEAR/Structures/Graph/Manipulator/AcyclicTest.php';

Zend Framework: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

As you may have known that I switched from ubuntu to windows from my previous questions. I was working on Zend Framework on ubuntu and now working on same project in windows. Because of this switching I am facing some problems in windows which was not occurred in ubuntu.
Now I have the following error in firebug console when I go to login page:
<b>Fatal error</b>: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in <b>C:\wamp\www\vcred\library\Zend\Db\Adapter\Pdo\Mysql.php</b> on line <b>93</b><br />
Do you people know that what type of error is this and what is the solution?
I have the following configuration for database.
resources.db.adapter = "Pdo_Mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "test"
resources.db.params.charset = "utf8"
Thanks
I just had the same error with PHP 5.2.6, and all I had to do is to open php.ini (e.g. on Windows: C:\Windows\php.ini, or on Ubuntu: /etc/php5/apache2/php.ini or sg. like this) in a text editor, and remove the semicolon from the following line:
;extension=php_pdo_mysql.dll
So as a result it would look like this in php.ini:
extension=php_pdo_mysql.dll
That solved my problem.
This looks related to this bug on PHP's bugtracker : Bug #47224 MYSQL_ATTR_INIT_COMMAND is no longer available
It seems it's been fixed in SVN -- but maybe not in the version of PHP you are using ?
Quoting one of the comments :
[2009-07-02 06:43 UTC] mg at artigo
dot pl A temporary solution is to
use INT value (1002) instead of
constant.
This might be a temporary solution, until you install a new version of PHP, in which the bug is fixed ?
Looks like a Windows bug in PHP 5.3 that was fixed in SVN a while ago. You might want to try updating to the latest PHP release to see if the issue still exists.
I got the same error, on debian6, when I had not yet installed php-mysql so, I simply installed this, like this
apt-get install php5-mysql
/etc/init.d/apache2 restart
I just add it here, in case other have same problem, to save them them a few minutes of research.

Resources