CodeIgniter 1.72 and PHP 5.3.29 compatible? - php

We're upgrading our server infrastructure on Amazon and I'm attempting to migrate a PHP site based on CodeIgniter (version 1.7.2) to a new server which has AmazonLinux as the OS. The previous server was Ubuntu, running PHP 5.3.3-1ubuntu9.5 on apache2. The PHP version on the new AmazonLinux server is 5.3.29, running on httpd.
When I try to access the URL in the new server, the code is currently stopping in system/core/CodeIgniter.php at this line:
$CI = new $class();
I haven't been able to see any relevant error messages in the httpd error log specified in virtual hosts for the app, nor in the default httpd error log. Using the lynx command line client to access the URL simply shows a internal server 500 error, while accessing through a regular browser just shows a blank page.
Any ideas? I know the Code Igniter version is pretty old, circa 2009. But it's compatible with PHP 5.3, which we're running on the new server. This is legacy code and will disappear at some point, so we have no interest in upgrading the PHP or CI level - unless we're forced to due to the upgrade.

The problem turned out to be a database access issue. Specifically, the version of PHP on the new server turned out to not support deprecated calls to php-mysql APIs (e.g. #mysql_pconnect or #mysql_connect)
The solution was to
1) Download the mysql library which supports the legacy calls. In the case of AmazonLinux, this is accomplished as follows:
sudo yum install php-mysql
2) Find where the library was downloaded e.g.
find / -name mysql.so
This may have been shown in the install as well, but that is a way to find it anytime. YMMV, but in my case, the library name was:
/usr/lib64/php-zts/modules/mysql.so
3) Change php.ini (as shown in phpinfo when called from a php page on the httpd/apached server) as follows:
a) change "extension_dir" to show where the mysql.so is installed:
extension_dir = "/usr/lib64/php-zts/modules"
b) Then add the following lines:
extension=mysqli.so
extension=mysql.so
extension=pdo_mysql.so
Reboot apache and you should be good to go.
Note: the specific legacy call not supported, which is part of of the version of CodeIgnitor I'm working with, was this:
return #mysql_pconnect($this->hostname, $this->username, $this-
The php error log showed this error:
PHP Fatal error: Call to undefined function mysql_connect() in xxx.php on line xx

Related

PHP Startup: Unable to load dynamic library php_msgpack_serialize

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/memcached.so' - /usr/lib/php/20131226/memcached.so: undefined symbol: php_msgpack_serialize in Unknown on line 0
Earlier today, I enabled forwarding of messages to root#localhost on my server to beam back to my personal email.
I have been receiving the above error message at 30 minutes intervals since. Of course, I checked and there's a PHP session cleaning script attached to cron to run at 30 minutes interval.
I have been searching around but couldn't find any specific solution.
My setup:
memcached 1.4.25
PHP 7.0
nginx/1.10.0
mysql Ver 14.14 Distrib 5.7.13
Ubuntu Server LTS 16.04
The closest I found to my issue above was this: http://community.rtcamp.com/t/php-warning-error-php-msgpack-serialize/6262 but there's no answer on that thread.
First you need to work out which PHP ini files are being loaded. From command line you can run php --ini. Technically apache/nginx can be running a different version, and you can look up using phpinfo(); exit(); test script if you want to view that one instead. As you're using cron, you're using the command line version anyway.
In one of these files you will find a line similar to:
extension="memcache.so"
If you don't need this extension at all, then just comment it out by prepending it with a ;:
;extension="memcache.so"
If you DO need the extension then it sounds like you need to rebuild this module. The easiest way is using PECL.
pecl install memcache
You might need to follow some instructions whilst running the install. Once it's done, you should be able to run php -v and it shouldn't output the same warning. If this has worked and you just see the php versions, you should restart nginx (if you need it on the website, the command line one should work instantly). :
sudo service nginx restart
I guess you can get a help from a similar topic on the site here.
But briefly, one of your extensions is loading memcache and the path in that is not correct.
You should find it in your php.ini and fix the path manually.
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
Check if msgpack extension is installed and enabled (php -i | grep msgpack).
It seems that PHP in Ubuntu is compiled with it by default.
If it's installed and enabled, then check you memcached extension. Maybe you are using it from a previous installation or something similar.
tl;dr: I eventually had to clear everything PHP that is less than php7.0 from my server manually, along with their related cron jobs.
Long story:
Going through my running process (ps -aux | grep 'php'), I realized php5 is still in there running. Everything on my server uses PHP7, so that lingering process was redundant, plus there was a cron job that runs a session cleaning job on the php5 somewhere, using a script which goes looking for the so-called missing Memcached file.
After removing all phps that are less than php7 from system via apt, I also went in to delete all the existing folders that are less than php7 in /usr/lib/php5 and or /usr/lib/php/ along with their cron related jobs found in /etc/cron.d/php5 and or /etc/cron.d/php/
No more whining warnings from PHP session cleaning about memcache
I was getting a similar error with memcache.so and I noticed there was a new version of memcache that was installed the moment the system ran 'pecl install memcache' (automatically that updated to the latest version). The new version caused that error so I had to change the version 1 version lower to pecl install memcache-4.0.5.2 and it worked. Thanks #Farkie for that insight, that's when I realized that there was a new version that just came out a few days ago and that was it!
Just install msgpack extension and the error message should disappear:
apt install php-msgpack
You might also be missing igbinary extension:
apt install php-igbinary

PHP Warning at startup while trying to load php_oci8.dll

I'm using XAMPP and trying to configure Oracle connection for sql.
I uncommented the line extension=php_oci8.dll and at first it ended up with an error (that oci.dll is missing), but later I downloaded instantclient from Oracle web pages. I tried with versions 10.2, 11.2, and 12.1 but neither worked. Obviously I've added the path to those libraries to my PATH env variable.
The warning I'm getting at the startup of Apache is: PHP Warning: PHP Startup: in Unknown on line 0
The error when I'm trying to connect is: PHP Fatal error: Call to undefined function oci_connect() in ...
I've tried with php_oci8.dll and php_oci8_11g.dll. Those files are in my php/ext directory (they were included in xampp), my instantclient is added to PATH and the warning doesn't show up if I disable those modules. I've tried restarting services and computer.
Can you help me find a solution how to configure it correctly? I'm using Windows 8.1 with administrative privileges.
BTW. My phpinfo() says that OCI8 is activated (but functions like oci_connect still don't work).
EDIT: When I tried running PHP manually I finally got the error to display what was wrong: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application. in Unknown on line 0 Can you help me find out where can I download a correct version?
There was a problem with 64bit version of instantclient. If you ever have the same issue, please install 32bit version of instantclient.
To be honest the easiest way is just to follow PROPER instructions: http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
I tried a lot of other advices and they all went really bad on me (not just because I used different bit version - also I copied the files everywhere following stupid advices and it was hard to correct it)
Its because your Oracle is 64 bit. Remove it and install a 32 bit version of Oracle client and it will work.
It looks like your extension are not install properly. Try to update it or reinstall it with pecl with
pecl install extname
You should also check extension_dir directive in php.ini and check if the PHP folder is added to the path
There's an alternate way to solve this: Install the full Oracle Client, not the basic zip, you can get it at oracle site (about 1Gb):
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-windows-3633015.html
Im using Windows 10, Apache 2.4, PHP 7.1 (all x64) and it works. Also tryed PHP 5.6 and it works too. Still use the php_oci8_11g.dll from the basic client zip to match your php and system version.
You can search the site to find older client versions (11g, 32bits, etc) but Im working with de 12c client and accessing an Oracle 11g enterprise server.
I found a lot of occurrencies of this same error all around, but none gave me this solution. Hope taht helps.

Mongodb running with node and PHP

I am new to Node.js and MongoDB. I have successfully got the mongoDB running with node.js and am able to start it up and store data inside of collections. So the server is already running on localhost:27017 and works when accessing localhost:28017 .
Now that I have it running and working within Node, I wanted to test MongoDB out with PHP on my Xampp server running on Ubuntu, but am not able to get the phpinfo() to say it is using mongo yet.
I have followed the steps here to configure and install the driver. I have moved the mongo.so file to my xampps extensions and added the appropriate line in php.ini + restarted. But phpinfo() still doesn't show it.
I guess i am confused on the aspect of where do i put the mongo-php-driver folder? is this installed into the Xampp server as well, if so where do i put it?
It is already running and working using node.js , so was just getting confused why it wasn't working properly or getting connected.
Also while I'm at it, Is it possible to have php and node.js use the same mongoDB server running on port 27017?
EDIT:
I was able to get the server to at least give me an error message about the file after i edited the extension_dir to the correct path
extension_lib = "/opt/lampp/lib/php/extensions/no-debug-zts-20090626"
i am now getting this error
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
i guess I needed to change that php.ini option to get it to load properly. but it seems I have compiled the wrong mongo.so build. I try again.
Thanks
According to this:
http://montenasoft.com/en/blog/how-install-pecl-php-extension-64bit-linux-while-you-are-using-32bit-xampp
Because xampp is compiled with 32 bit, but the mongo driver you compile is 64 bit.
You may have to compile your mongo driver with these:
phpize
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
make
sudo make install
Or just install apache2, mysql, php separately. I think this is a better option.

MSSQL error (saying not enabled when it is) using WAMP / PHP 5.3.4

I am getting an error:
"Fatal error: Uncaught exception 'RuntimeException' with message 'The "mssql" extension is not loaded' in ..."
Though it is enabled. In php.ini (PHP version 5.3.4) it is uncommented out (no ;) before extension=php_mssql.dll and its showing up as checked off on the PHP extentions list in wamps system tray menu. What might be causing this?
Also semi related, I can't run php version 5.3.1. I downloaded and installed it but when i switch to it in wamp, the wamp system try stays yellow (instead of white indicating its ready to go). And no php loads anywhere / can't get to localhost or phpmyadmin at all. I tried to run 5.3.1 as a work around for this mssql error.
I am running WampServer Version 2.1 on a windows 7 64 bit box. This same exact setup works just fine on my windows XP (32-bit) box running 5.3.1.
Same issue. My apache log is showing
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.4/ext/php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0.
I have the same issue with the ZIP module. The modules are legitimately not there.
I tried downgrading to PHP 5.3.1 from http://www.wampserver.com/en/addons_php.php, but then my Apache wouldn't start up at all; I'm guessing that was an x64/x86 issue.
Then tried copying the php_mssql.dll from 5.3.1 to my 5.3.4 directory, then restarting apache and it was just more fail with
PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.4/ext/php_mssql.dll' - %1 is not a valid Win32 application.
Installing WampServer 2.1e (the active build) but 32-bit to see if there were any differences. There were. This build packages PHP 5.3.5, which still doesn't include php_mssql.dll. BUT I was then able to use PHP 5.3.1 I had downloaded (apparently it is capable with this WAMP Build, whether because it's 2.1e or because 32-bit, I don't know or care).
So, the point of the story is that if you're trying to use WAMP Server with PHP's MSSQL extension, you're going to want Wamp Server 2.1e (32-bit, specifically) and PHP 5.3.1.
Also note, I still can't get the ZIP extension working with this setup, but luckily for me it's not essential to my current project.
Hope that helps someone.

Differences between PHP 5.2.x and 5.3.x with respect to the SOAP library

I have developed a PHP site using PHP 5.3.4 and deployed it to a server that has PHP 5.2.6 installed. I am not doing anything fancy; in fact, the only major library I am using is PHP's native SOAP library.
However, when I test my deployed site, I get the error:
Fatal error: Class 'SoapClient' not found in (path) on line 20
Are there any major differences between PHP 5.2.x and 5.3.x with respect to the SOAP library? I have already changed the configuration files. (Well, actually I told the sysadmin to do it, because I don't have permission to do so.) And I get the same error. Any ideas?
EDIT: More information...
I'm deploying my site to a Windows server.
The server has AppServ installed.
For some reason I don't understand, PHP's configuration file is C:\Windows\php.ini instead of PHP_DIR\php.ini.
I dont think soap is installed on the server try
sudo aptitude install php-soap
change the following line in php.ini:
;extension=php_soap.dll // before
extension=php_soap.dll // after
this enables the soap extension since PHP 5.0

Categories