Installing PDO-drivers for PostgreSQL on Mac (using Zend for eclipse) - eclipse

How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.

I had to install the PDO_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I've found can help others (like myself) who will undoubtedly run into similar problems.
The first thing you'll need to do is install PEAR, if you haven't done so already, since it doesn't come installed on Leopard by default.
Once you do that, use the PECL installer to download the PDO_PGSQL package:
$ pecl download pdo_pgsql
$ tar xzf PDO_PGSQL-1.0.2.tgz
(Note: you may have to run pecl as the superuser, i.e. sudo pecl.)
After that, since the PECL installer can't install the extension directly, you'll need to build and install it yourself:
$ cd PDO_PGSQL-1.0.2
$ phpize
$ ./configure --with-pdo-pgsql=/path/to/your/PostgreSQL/installation
$ make && sudo make install
If all goes well, you should have a file called "pdo_pgsql.so" sitting in a directory that should look something like "/usr/lib/php/extensions/no-debug-non-zts-20060613/" (the PECL installation should have outputted the directory it installed the extension to).
To finalize the installation, you'll need to edit your php.ini file. Find the section labeled "Dynamic Extensions", and underneath the list of (probably commented out) extensions, add this line:
extension=pdo_pgsql.so
Now, assuming this is the first time you've installed PHP extensions, there are two additional steps you need to take in order to get this working. First, in php.ini, find the extension_dir directive (under "Paths and Directories"), and change it to the directory that the pdo_pgsql.so file was installed in. For example, my extension_dir directive looks like:
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
The second step, if you're on a 64-bit Intel Mac, involves making Apache run in 32-bit mode. (If there's a better strategy, I'd like to know, but for now, this is the best I could find.) In order to do this, edit the property list file located at /System/Library/LaunchDaemons/org.apache.httpd.plist. Find these two lines:
<key>ProgramArguments</key>
<array>
Under them, add these three lines:
<string>arch</string>
<string>-arch</string>
<string>i386</string>
Now, just restart Apache, and PDO_PGSQL will be up and running.

Take a look at this PECL package: PDO_PGSQL
I haven't tried it myself, but I've been interested in playing with Postgres as an alternative to MySQL. If I have a chance to try it soon, I'll throw my results up here in case it helps.

I'm not sure this will help with the PDO drivers specifically, but you might look into BitNami's MAPPStack.
I had a ton of trouble with Postgres, PHP, and Apache on my Mac, some of it having to do with 64- vs 32-bit versions of some or all of them. So far, the BitNami MAPPStack install is working nicely in general. Maybe it will help with your PDO issues as well.

Install new php version via brew and restart server, and php -v, all issues are removed.

This is what worked for me
brew install php55-pdo-pgsql
This installs PHP 5.5.32 and PostgreSQL 9.5. I already had PostgreSQL 9.4 installed so I uninstalled the homebrew version with:
brew uninstall postgres
You then have to update /etc/apache2/httpd.conf to point to the correct PHP version and restart Apache:
LoadModule php5_module /usr/local/Cellar/php55/5.5.32/libexec/apache2/libphp5.so
My OSX version is Yosemite.

Related

How I can open pgadmin4 in fedora 36?

Good evening people, I am trying to install pgadmin4 on fedora 36, I followed all the steps in the documentation and pgadmin4 and its dependencies were installed correctly but I do not know how to start it, or open it and it does not let me configure it on the web because I do not create the directory described in the final step to configure the web version.
I had the same problem. I solved it installing pgadmin4 from linux-pachages
https://linux-packages.com/fedora-36/package/pgadmin4-qtx86-64
I followed the same instructions but mistakenly changing "yum" to "dnf" out of force of habit. I found I got an install out of it which seemed OK at a glance, but it was just documentation and not an executable, and there was no shortcut added to run pgAdmin. Perhaps you might have inadvertently done something similar? After uninstalling, I tried again using "yum" exactly as documented and the latest executable installed without any issue. So the steps to install that would work for me were as follows. (Desktop version in my case.)
sudo rpm -e pgadmin4-fedora-repo
sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-fedora-repo-2-1.noarch.rpm
sudo yum install pgadmin4-desktop
The QT workaround also mentioned as an answer worked for me, but I wanted to avoid that since it is an earlier release (6.9) than the current 6.11, isn't officially supported and fires a warning about that every time on start up saying some functionality may be missing, which is not good for clients to see potentially in my case.
Same problem - couldn't open it after installing. You have to install pgadmin4-desktop not pgadmin4.

How do I delete the Postgresql 13 installed by MacPorts?

I tried installing Postgresql 13 on my new computer using MacPorts and have been completely unsuccessful getting anything to run, and not even sure if it is actually completely or properly installed, and I would like to delete all the Postgresql installed by MacPorts on my system.
The only directories for Postgres I have found are:
/opt/local/include
/opt/local/lib
/opt/local/share
nothing in:
/Library
This doesn't seem like the installation locations I have read anything about and I haven't found anything about uninstalling this from my system.
So, the question is, what do I do?
Do I just delete those directories and move forward with a different installation method, or look in other locations, or just leave it there and try to install Postgresql another way?
sudo port installed
sudo port uninstall postgresql13-server
. . .

Cannot use Swift on Ubuntu 18.04

After conscientiously following the install instructions on Linux from swift.org, I encounter an issue where it is not possible to compile anything on a Ubuntu 18.04 machine. The REPL seems to work but during compilation (when calling swift build) the following error appears:
/usr/bin/ld: cannot find -lstdc++
There are more details in the full bug report [SR-9093]. I don't know at all what to do to solve this issue, there are similar problems already mentioned in other bug reports, for instance on this really old one [SR-35].
What should I do?
Thank you
I am assuming that you had already installed the libstdc++ successfully and you have set the permissions properly. But I really doubt that it was installed correctly but it was installed with corruption of some sort. The corruption occurred because you didn't install libstdc++ via a package manager. Result was some form of weirdness in the package manager database which effected the overall functioning system. Exactly why adding something to a folder should change anything at all. I don't know why this happens, unless the folder is hot i.e symbolically linked to a program which doesn't have any tolerance for hacks like simply copying a file into the folder. So for now try to install the libstdc++ again. Below is the link to the file to again download the correct program and this is compatible with amd64.
http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
And below are some link to help
https://ubuntuforums.org/showthread.php?t=1425470
https://ubuntuforums.org/showthread.php?t=808045
https://ubuntuforums.org/showthread.php?t=808045
https://packages.ubuntu.com/search?keywords=libstdc%2B%2B
https://packages.ubuntu.com/xenial/amd64/libstdc++6
Install libstdc++
sudo apt install libstdc++6
It seems possible that the apt install did not run the ldconfig program, which should be run to add the library to the list of those which ld.so knows about.
It looks like you can do it manually:
sudo ldconfig
IMPORTANT CAVEAT: I don't have Ubuntu and haven't been able to test this. And it's a sudo command. Run at your own risk, YMMV, etc.
If this does not work, it's possible that a file called /etc/ld.so.conf is not set up to search the directory where libstdc++ ended up. I wouldn't dare try to describe how to fix that.
sudo apt install -f
The command above should install any missing dependencies.

Installing/activitating pgsql.so extension in CentOS 6

I am trying to install a student information system (RosarioSIS) that is PostgreSQL-driven. After installing PostgreSQL 9.6 , the system asks me to install and activate a php extension (pgsql.so). I tried 'yum install php-pgsql' command, but it didn't work for some reason. I have tried all the suggested solutions on Stackoverflow and other forums, but still no luck. The last thing I tried is unarchiving a copy of php 5.4.45 and compiling the extension manually using:
phpize
./configure
make
sudo make install
This also did not manage to add the pgsql.so to the folder extension. What do you suggest I do in order to add the required extension (pgsql.so) to where it belongs?
PHP 5.6 release date is far earlier than PostgrSQL 9.6 (PG96). When PHP56 is released, it wasn't knowing about PG96. Try installing PostgreSQL 9.3 and you'll see everything works great. BTW, even PHP7.1 doesn't have client library for PG96 in FreeBSD ports tree.

How to run PHP 5.5.4 mcrypt run on CentOS 6.4?

I am getting the following error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' -
/lib64/libc.so.6: version `GLIBC_2.14' not found (required by
/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so)
Does mcrypt require glibc 2.14?
We are running CentOS 6.4 (latest stable version of CentOS) and it comes with glibc 2.12 (can't really upgrade glibc as being a core part of OS, changing it will likely break lots of stuff)
How do I make my PHP 5.5.4 run mcsypt under these circumstances?
Current configuration (phpinfo output) is here.
I was also having issues installing mcrypt on my VPS dev server so I thought I would post my solution in the hopes that it helps someone. I am running Centos OS 6.5 and had upgraded PHP to 5.5.13 using the Webtatic EL yum repository. https://webtatic.com/packages/php55/
First shh into your server
ssh admin#domain.com
initially I was trying to do (which was not working):
yum update
yum install php-mcrypt
I then realized my mistake when I looked at php -v and realized php-common was conflicting as the above code was trying to load a dependency from 5.3.
I then executed the following correct commands:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum update
yum install php55w-mcrypt
service httpd restart
This worked perfectly for me.
I also read while researching this issue that some people did have to add the extension to their .ini file manually by adding the following line but i did not have to do this.
extension=mcrypt.so
you can find the location of your php.ini file by looking at phpinfo(); and see which configuration it is loading. For me the following ini files were loading:
/etc/php.ini
/etc/php.d/mcrypt.ini
/var/www/vhosts/system/domain.com/etc/php.ini
If the installation is successful then you will see the extension when you echo phpinfo();
Try installing php-mcrypt using yum. That should pull in any other libraries you need to run it.
yum install php-mcrypt
In light of your update, it would appear that you are trying to use the MCrypt extension built from another PHP Source which was created by an updated GLIBC library. The only proper solution I can see is the following:
You first need to ensure you have libmcrypt, libmcrypt-devel, and mcrypt installed before continuing. Check your CentOS repository.
Download the PHP Source from http://php.net
Untar the downloaded source tar -zxf php-5.5.4.tar.gz
cd into the source cd php-5.4.4
Copy your current ./configure string. The whole thing!
Add support for Mcrypt --with-mcrypt=/usr and run the new configure command
make && make install
restart Apache and PHP-FPM
This will keep your current configuration just as CentOS has built it but with the additional support of MCrypt as you are looking to have. Once you've done this, you do not need to enable the MCrypt extension in your php.ini file as it will be built into PHP itself and will be automatically loaded for you now.
When in doubt, you can also read up on the installation here http://us1.php.net/manual/en/mcrypt.installation.php