Fatal error: Class 'PHPExcel_Shared_String' not found - php

I have used PHPExcel for my codeigniter app and it is working perfectly in localhost, but when I host this to server, I am getting following error :
Fatal error: Class 'PHPExcel_Shared_String' not found in \xx\xx\xx
third_party\PHPExcel\Autoloader.php on line 36

There was a change introduced to the autoloader in the latest version of PHPExcel that appears to have broken backward compatibility with versions of PHP < 5.3.0
If you edit the Classes/PHPExcel/Autoloader.php file and change line 58, which should read
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
to
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
I've already made a change to the develop branch on github to test for the PHP version and execute the appropriate line
While this was not deliberate, please note that we really are trying to get users to upgrade to at least version 5.3.0 of PHP, because we can't address any of the memory/performance issues that users working with large spreadsheets complain about until we can use some of the new features available in more recent versions of PHP. Version 5.2 of PHP is no longer supported, and even version 5.3 is end-of-life and will be unsupported before the end of this year

struggled with this issue for a long time under Linux and PHP 5.4x. In the end, in addition to the fix above, I resorted to changing the code on line 73 of the Autoloader file which sets the $pClassFilePath variable from relative (using PHPEXCEL_ROOT) to absolute following the machines file tree. This might only be a hack, but it saved my sanity after several days of trying. Hope this helps someone. Cheers

I had this issue too and i solved it by changing permissions on "Shared" directory to 655.
I Hope it helps

If your server is on Linux, it can be permission problem... Just add all permissions for PHPExcel Folder in you Vendor (on server side) and all subfolders for it. I have same problem and i have solved it by this way...

What worked for me was changing PHPExcel/Autoloader.php line 81 from
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
to
if ((stream_resolve_include_path($pClassFilePath) === FALSE)) {
I prefer this approach because it didn't require me to modify file permissions and it should work in PHP 5.3.2 and later.

Related

Trouble with CKFinder + Laravel 8

I did everything according to points 1-5 as indicated in the Readme.MD
https://github.com/ckfinder/ckfinder-laravel-package#configuring-authentication
On site authors say: At this point you should see the connector JSON response after navigating to the <APP BASE URL>/ckfinder/connector?command=Init address. Authentication for CKFinder is not configured yet, so you will see an error response saying that CKFinder is not enabled
I opened link
http://127.0.0.1:8000/ckfinder/connector?command=Init
And have JSON error:
{"error":{"number":110,"message":"Unknown error."}}
Can someone help me? How to find reason of trouble? i google many sites and there is no desicion
Are you using PHP 8+?
For me the issue was a deprecated line in the package itself.
I fixed this error by changing vendor\ckfinder\ckfinder-laravel-package\_connector\ArgumentResolver.php line 65
from
if ($reflectionClass = $param->getClass()) {
to
if ($reflectionClass = new \ReflectionClass($param->getType()->getName())) {
because getClass() is deprecated in PHP 8.0.3, It works fine for me now.
Note: Do keep in mind that it's not good to change things inside the vendor folder!

PHP class 'Ds\Map' not found

In PHP (version 7.1), I am attempting to use a MAP as opposed to a two dimensional array to handle implicit data type conversion across different data type groups. However, I am receiving the following run-time error:
Class 'Ds\Map' not found
The error occurs on this line of code:
protected $hive_data_type_group_map = new \Ds\Map();
I have checked online, but there is little documentation on Ds\Map, even on PHP's website (click here). Does anyone know how to fix this?
Data Structures is not a built-in PHP extension.
It needs to be installed before use. The installation instructions are available on php.net.
For windows
Download compiled-dll file "php_ds.dll" from https://pecl.php.net/package/ds. Place it in your dir wamp\bin\php\[your_php_version_folder]\ext and include it in your ".ini" file.
It worked for me.
the easiest way on ubuntu:
pecl install ds
Reference: https://www.php.net/manual/en/ds-deque.allocate.php

Codeigniter 3.1.7 valid_email issue

I have two sites using Codeigniter. Today I have updated sites to Codeigniter 3.1.7 (from 3.1.6). After that at one of this sites email validation had broken, valid_email validation rule doesn't work any more. On second site all fine. I had check out error logs and found error:
ERROR - 2018-02-06 10:13:21 --> Severity: Warning --> idn_to_ascii() expects parameter 3 to be long, string given /public_html/system/libraries/Form_validation.php 1235
Codeigniter's changlog says:
Updated Form Validation Library rule valid_email to use INTL_IDNA_VARIANT_UTS46 for non-ASCII domain names.
It seems to me that INTL_IDNA_VARIANT_UTS46 constant is not defined. Site using PHP Version 5.6.30
How can I fix this issue?
I found discussion of this problem here.
Issue is outdated ICU library (ICU version 4.2.1 was installed)
Go to system/library/email.php and replace valid_email()
public function valid_email($email)
{
if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46') && $atpos = strpos($email, '#'))
{
$email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46);
}
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
just get the latest library for email
Get the latest codeigniter zip file
then go to system->libraries->Email file
copy that email file and paste it into your previous Email.php library file then it will work
I think there's a better way to sort out that issue.
As we all know that email library not supported in php 7.2 and that's why error occured
idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated
Error Screenshot of codeigniter email library
Quick Solution :
--> Go to cPanel
--> Select PHP version
--> change it to 7.1 instead of 7.2
For my case. I am also facing this issue.
Error:
Severity: 8192
Message: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated Filename: libraries/Form_validation.php
Line Number: 1234
I downloaded the Latest CodeIgniter version. Then from the system/libraries folder copied Email.php and Form_validation.php. Then replaced with Existing Email.php and Form_validation.php at the same path.
After replace, It is start working Fine..!!
Thanks #Evgeny for Guide.
The above issue would occur when you have incompatible CI and PHP version combinations. I mean newer PHP version and older CI version, vice-versa. I had PHP 7.3 on my machine and the CI repo/project I downloaded from github had CI version 3.1.5. I had to replace the system folder (of 3.1.5 with that of newer CI versions, 3.1.10 in my case) to resolve this issue

error in phpmyadmin after updating to PHP 7.2.0

Recently I update my PHP version to 7.2.0 .
When I open my phpmyadmin I have face this warning every time when i open any table in database.
If anyone have know about it, Let me know.
Thanks in advance.
I have the same issue. Take care about the error. If you see the image the warning are on the line 601, in my case was on line 613.
To solve edit sql.lib.php
change this line:
|| (count($analyzed_sql_results['select_expr'] == 1)
By:
|| (count($analyzed_sql_results['select_expr']) == 1
Regards and happy new year 2019 !
This #601 error was also tied to #532 line error too in my case.
The additional #532 complication is phpmyadmin’s attempt to try to count some parameter, invalid in newer PHP versions as they can’t use count() or sizeof() with an array type.
Edit /usr/share/phpmyadmin/libraries/plugin_interface.lib.php line #532 in whatever text editor you please. find this erronous code:
if ($options != null && count($options) > 0) {
Force parameter to array is easy way to solve this:
if ($options != null && count((array)$options) > 0) {
big thanks #chaloemphonthipkasorn for the suggestions
Up your PMA to the last version
https://github.com/phpmyadmin/phpmyadmin/pull/13414/commits/4b037582d9ac1686f2c4ba5e05d4ab61729d570a
https://launchpad.net/~nijel/+archive/ubuntu/phpmyadmin
Note: This repository is currently a bit behind as I struggle to find time to update it to 4.7 series, see https://bugs.debian.org/879741. There are no severe security vulnerabilities in the 4.6.6 currently packaged here (https://www.phpmyadmin.net/security/PMASA-2017-9/ applies only to 4.7 series). The only major problem is that 4.6.6 doesn't work properly with PHP 7.2.
It will have this error for php7.2 at the moment.
You can manually download/unzip the phpmyadmin and install in your server.
if you have an existing or old version of phpMyAdmin configuration on your computer, always check if you already remove or make sure that the old files/history of the config is fully or successfully deleted/already empty in order for your newly installed/updated config to work properly with no any bugs or errors. After you make sure that the old file configuration is already clean, your existing version of phpMyAdmin will be replaced by the version you've configured.
For more information. See this link: https://docs.phpmyadmin.net/en/latest/setup.html#upgrading-from-an-older-version

CakePHP 3.0 not running on other machines

I've developed a small project on a machine, using CakePHP 3.0, and I need it to run on another machine. I've tried to install it on several other machines.
If I run the composer to install the CakePHP 3.0, then I copy my stuff to overwrite it, the project works. I've tried this on two machines and had no problem so far. If I don't run the composer, and just copy the stuff to the target machine, it gives me the following error. I've tried this on 3 machines, and every machine gives me this:
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
I've copied the whole project to this server to test.
I told you this because I thought it has something to do with my problem. The point is that I have to run this on a machine that is not mine, and I can't install composer on it. The /public_html/vendor/cakephp/cakephp/src/I18n/ has files related to internationalization and localization, but my project will never be translated, so a workaround to make the project ignore those files would be enough to solve my problem.
The following code is an excerpt from the (...)/I18n/I18n.php that might be relevant:
<?php
namespace Cake\I18n;
use Aura\Intl\FormatterLocator;
use Aura\Intl\PackageLocator;
use Aura\Intl\TranslatorFactory;
use Cake\I18n\Formatter\IcuFormatter;
use Cake\I18n\Formatter\SprintfFormatter;
use Locale;
class I18n {
// lots of code here
public static function defaultLocale() {
if (static::$_defaultLocale === null) {
static::$_defaultLocale = Locale::getDefault() ?: 'en_US';
// the line above is the Line 229
}
return static::$_defaultLocale;
}
// many code here too
}
I've checked that another file also tries to access this Locale class, but I don't know if there are other files trying to access it as well. Many files from everywhere inside the project tries to access methods from I18n.php. I need it running but I can't figure out how to make it run.
Any help will be greatly appreciated.
As I just found out, prior to CakePHP 3.0, the installation must be done by composer, as stated in the 3.0 migration guide:
CakePHP should be installed with Composer
Since CakePHP can no longer easily be installed via PEAR, or in a shared
directory, those options are no longer supported. Instead you should use
Composer to install CakePHP into your application.
So it won't run on regular free web hosting services.

Categories