I have looked at multiple SO threads and none of them seem to have my problem. I have compiled and install the pro_pgsql extension as outlined here: http://blog.rupey.org/post/63221360055/adding-postgres-support-to-php-on-os-x-mavericks and verified that it is loaded by running php -m apache has been restarted, php_info shows the following:
But when I run this script:
echo "hi!";
$ebdb_conn = pg_connect('dbname=mydb user=frank password=frank123') or die(pg_last_error());
I get the following error in the log:
[Mon Jun 09 12:39:05 2014] [error] [client ::1] PHP Fatal error: Call to undefined function pg_connect() in /Users/frank/Code/ebus/test.php on line 4
This is on OSX Mavericks, with Apache and PHP 5.2.24. Any ideas?
This problem was eventually solved by uninstalling everything that had to do with the Enterprise DB postgres package and reinstalling it with a consistent set of packages. I still, unfortunately have a non-matching psql client on the machine but other than that it is working fine. For others seeing this, I recommend:
DO NOT use enterprise DB installer found on the postgres website on OSX Mavericks use one of the following
1) postgres app (http://postgresapp.com) nice because its has postGIS and other extensions built in
2) map ports packages (https://trac.macports.org/browser/trunk/dports/databases/postgresql82/Portfile)
3) brew installer (http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/)
pg_connect isn't a part of the PDO library. It's contained in the direct postgresql library for PHP. In MacPorts, that's php5-postgresql, which macports gets from http://lil.fr.packages.macports.org/php5-postgresql.
Related
I just upgraded from php5.6. => php7.2.5
All of my websites are working except one that it only workd correctly with the php5_module and not with the php7_module.
Is there soem way to only have installed php7.2.5 but also use the php5_module as well?
This the error iam getting from a domain when i upgraded from php56 => php72
[Mon May 21 10:33:21.490109 2018] [proxy_fcgi:error] [pid 19775] [client 66.249.66.193:39398] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function split() in /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/misc.php:19\nStack trace:\n#0 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/navigation.php(271): theme_trim_long_str('\xCE\x91\xCF\x81\xCF\x87\xCE\xB9\xCE\xBA\xCE\xAE', '45')\n#1 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/navigation.php(343): theme_MenuItem->get_start(0)\n#2 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/navigation.php(315): theme_MenuWalker->display('', Array)\n#3 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/navigation.php(92): theme_MenuWalker->walk(Array, Array)\n#4 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/library/navigation.php(17): theme_get_list_menu(Array)\n#5 /home/akis/public_html/wp-content/themes/business_for_sale_1-1/header.php(62): theme_get_menu(Array)\n#6 /home/akis/public_html/wp-includes/template.php(688...\n'
Your error states:
Call to undefined function split()
After a quick google search I found this article in the PHP documentation:
http://php.net/manual/en/function.split.php
Warning. This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
Alternatives to this function include:
preg_split()
explode()
str_split()
Please conciser using one of the alternatives.
This is why you shouldn't use deprecated functions when writing code, because they will soon disappear and your code will crash when upgrading versions.
Yeah.. why not, you can have both versions installed. And you can enable or disable your PHP versions using the below commands if your are on a linux machine (ubuntu)
sudo a2dismod php7.2 (**Replace it with your PHP7 version**)
sudo a2enmod php5.6 (**To enable your PHP5.x version**)
sudo service apache2 restart (**Restart Apache**)
Again, if you want to enable 7.2 just replace it vice versa.
Note : Remember though, you can't have both versions working at the same time.
I think you can give https://github.com/cfebs/phpvm a go, this works well with my local environment.
Another option is to use Docker, create a container with both PHP versions and put your app into those containers to compare. Another good thing with a docker is that you can change docker-compose file to a version that suits you best.
I'm trying to connect a SQLite Database using PDO, but i am getting this error:
Uncaught exception 'PDOException' with message 'could not find driver'
In my code:
$db = new PDO('sqlite:remedios.sqlite');
Also, the command PDO::getAvailableDrivers() lists only mysql.
I am using a Ubuntu 14.04
But the problem is that I already installed pdo_sqlite (installed with apt-get sqlite3 php5-sqlite).
I also checked it on:
My phpinfo() shows sqlite3 (phpinfo is here: PHPInfo)
I have extension=pdo_sqlite.so in my PHP configuration file in /etc/php5/apache2/conf.d/20-pdo_sqlite.ini (phpinfo lists this file in "Additional .ini files parsed")
I have pdo_sqlite.so in folder /usr/lib/php5/20121212
Already tried to reinstall sqlite3, php5, php5-sqlite
Edit
Configurations files below:
20-pdo_sqlite.ini
; configuration for php SQLite module
; priority=20
extension=pdo_sqlite.so
20-sqlite3.ini
; configuration for php SQLite module
; priority=20
extension=sqlite3.so
Edit2
Find this error on apache error.log
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_sqlite.so' - /usr/lib/php5/20121212/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name in Unknown on line 0
[Fri Nov 13 00:03:42.704671 2015] [mpm_prefork:notice] [pid 1938] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 OpenSSL/1.0.1f configured -- resuming normal operations
[Fri Nov 13 00:03:42.704702 2015] [core:notice] [pid 1938] AH00094: Command line: '/usr/sbin/apache2'
You are missing the SQLite client library, I think the package is libsqlite3-0 on Ubuntu:
apt-get install libsqlite3-0
restart Apache after that.
UPDATE - we figured it out in the chat with the help of ldconfig -p | grep sqlite. It found a stale installation of libsqlite3 in /usr/local/lib that was conflicting with the one that Apache was using. Removing the conflicting installation, and re-installing sqlite3 packages solved the problem.
I've had similar problem and I think it is important to give another elaborate answer on this. The root of the problem was that I built my own newest version of sqlite from sources (repo for Ubuntu 16.04 is outdated) without SQLITE_ENABLE_COLUMN_METADATA definition. It worked before I restarted the machine. Probably it's the previous version was running or something like that, because after a reboot I've got the trouble.
http://source.online.free.fr/Linux_HowToCompileSQLite.html
The SQLitePass library uses specific SQLite functions to retrieve schema information on an SQL statement.
These functions are :
sqlite3_column_database_name
sqlite3_column_database_name16
sqlite3_column_table_name
sqlite3_column_table_name16
sqlite3_column_origin_name
sqlite3_column_origin_name16
sqlite3_table_column_metadata
Unfortunately, they are not always available in the precompiled library available on the SQLite webpage or in the sqlite package dedicated to your Linux distribution.
In order to get these functions in our sqlite3.so library, we need to compile the SQLite source code with the [SQLITE_ENABLE_COLUMN_METADATA] compiler directive.
That's why less +G /var/log/php_errors.log output had the line
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_sqlite.so' - /usr/lib/php/20151012/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name in Unknown on line 0
although the pdo_sqlite was present in phpinfo(); output all the time.
To solve the problem I did follow the compilation instructions by the link above: open sqlite3.c in the sources and after the lines
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
#ifndef SQLITE_PRIVATE
# define SQLITE_PRIVATE static
#endif
add
#define SQLITE_ENABLE_COLUMN_METADATA
then run
$ ./configure
$ make
$ make check
make: Nothing to be done for 'check'.
$ sudo make install
$ sudo service apache2 restart
and now sqlite is working again.
type this:
sudo apt-get install php5-sqlite
A few days ago I made the migration from Windows to Ubuntu as my server. I've been doing pretty well but I've had problems with Apache since day one.
I've finally gotten somewhere, but now I'm stuck at this problem with using a MySQLi method in my PHP log (in /var/log/apache2):
[Tue Jul 14 19:23:15.326084 2015] [:error] [pid 16858] [client 71.76.17.180:59078] PHP Fatal error: Call to undefined function mysqli_fetch_all() in /var/www/hausofalexander.ml/index.php on line 6
In phpinfo() MySQLi is showing as enabled. You can see the info at http://www.hausofalexander.ml/info.php.
I am completely lost. If you need some more info just ask. Thanks!
As Hobo Sapiens points out in the comment the function/method mysqli_fetch_all() is only available if the mysqlnd library is used.
I'm not an Ubuntu guy, but you might try
sudo php5enmod mysqlnd
and if this seems to work (no obvious error message) restart the httpd and then check the output of phpinfo() for a mysqlnd section.
Available only with mysqlnd
if you use PHP version under 5.4.0 , you should install the mysqlnd
http://php.net/manual/en/mysqlnd.install.php
sorry for brevious answer it was totally wrong
I am on OS X 10.9.5.
I installed Php 5.5 via homebrew and also the PHP 5.5 mcrypt extension, php55 and php55-mcrypt in homebrew. In order to enable php5 in apache, I added this to /etc/apache2/httpd.conf
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
I'm using Laravel and need the Mcrypt extension, so I added this to /usr/local/php/5.5/php.ini
extension=mcrypt.so
In order to force the terminal to use the proper PHP version, 5.5, rather than the 5.4 the computer shipped with, I renamed /usr/bin/php to /usr/bin/php-old, and now the terminal falls back to /usr/local/bin/php, which is the version 5.5 that I'd like to use. Now, I am getting the following error in the terminal whenever I do anything in php from terminal.
[Sat Sep 20 16:32:12 2014] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.17/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/local/Cellar/php55/5.5.17/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
Any ideas on how this happened or where I went wrong? I'm getting discouraged by this OSX development server setup and considering just giving in and installing a dual-booted Ubuntu Partition. I was hoping to leverage OSX's unix base, but it has been a nightmare to setup the dev server so far.
You seem to have messed with homebrew since your PHP is looking for files in Cellar. Run "which php" and check which PHP is actually running and run "php --ini" to make sure you edited the right PHP configuration.
The easiest way to get a proper running PHP is to install it from Homebrew and add that to your PATH.
I know there is several instances of this question throughout stackoverflow but I am not finding a solution.
I am running CentOS with Apache and PHP 5.3
A .php script is giving me this error:
Fatal error: Class 'PDO' not found in ...
I ran phpinfo(); and the only place "pdo" exists on the page is in the "Configure Command" '--disable-pdo' line.
I attempted #yum install php-pdo but no packages exist.
I also attempted #pecl install pdo and i get these errors at the end:
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_instantiate':
/root/tmp/pear/PDO/pdo_dbh.c:410: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c:411: error: 'zval' has no member named 'is_ref'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_stmt_construct':
/root/tmp/pear/PDO/pdo_dbh.c:435: error: 'zend_fcall_info' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c:458: error: 'zend_fcall_info_cache' has no member named 'object_pp'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'zim_PDO_setAttribute':
/root/tmp/pear/PDO/pdo_dbh.c:752: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'zim_PDO_getAttribute':
/root/tmp/pear/PDO/pdo_dbh.c:818: error: 'zval' has no member named 'refcount'
/root/tmp/pear/PDO/pdo_dbh.c: In function 'pdo_hash_methods':
/root/tmp/pear/PDO/pdo_dbh.c:1122: warning: assignment discards qualifiers from pointer target type
/root/tmp/pear/PDO/pdo_dbh.c:1126: warning: assignment discards qualifiers from pointer target type
make: *** [pdo_dbh.lo] Error 1
ERROR: `make' failed
Then on the php.net doc it basically says the package comes standard in php installations since PHP 5.1.
I added the line extension=pdo.so to php.ini and restarted Apache and the problem persists. Any suggestions?
I too have had a similar issue. I am using codeigniter and was getting a "pdo_mysql.so not found" error and tried everything to fix it. I must of searched thru the first 10 pages of google search results for multiple queries. I found tons of people with the same problems but for some reason none of them had an answer/fix. Thru all this reading I learned that "PDO and the PDO_SQLITE driver is enabled by default as of PHP 5.1.0." This got me thinking, "Perhaps I should remove the extension=pdo_mysql.so and pdo.so lines from my php.ini!" I figured php was trying to load an extension that was no longer there since it comes built in now. Sure enough, solved all my php error mess.
PHP 5.4.31 (cli) (built: Aug 19 2014 10:38:48)
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Server version: Apache/2.2.27 (Unix)
Server built: Aug 19 2014 10:33:30
Cpanel::Easy::Apache v3.26.5 rev9999
I'm pretty sure that you're missing the PHP_PDO package. Try to find the PDO package by running the command bellow:
# rpm -qa| grep "pdo"
Mine shows php53u-pdo-5.3.26-1.ius.el5
If you are using php 5.3 then try
# yum install php53u-pdo
I dont know if it is too late for the answer, but I'll post if someone finds this error.
First, I had installed php-pdo in Centos 7 with yum. I viewed phpinfo and it shows the pdo extension but not pdo-mysql.
So, If you then installs php-mysql (yum install php-mysql) it will install automatically the pdo-mysql extension.