I've installed WAMP Server on my computer so that I can develop my website, however I have come to run my existing code which is running on my staging host just fine without any errors.
I'm getting errors such as:
Fatal error: Cannot redeclare session_status() in >C:\wamp\www\uquiz\trunk\sessions\session.php on line 277
I have uncommented the line in the PHP config:
;zend_extension = "c:/wamp/bin/php/php5.4.3/zend_ext/php_xdebug-2.2.0-5.4-vc9-x86_64.dll"
But this hasn't suppressed the error.
I'm assuming that it's the ZEND Framework that may have already declared the function session_status()?
If I change the name of the function, the error disappears, but I don't want to be restricted.
It's a built-in PHP function as of 5.4.
Rename your function or downgrade to PHP 5.3
http://us.php.net/session-status
Related
So I have this script example.php:
<?php
$zip = new \ZipArchive();
if I call it from a browser it runs fine without any errors, but if I run it in CLI mode like this (from another php file):
<?php
echo system("php example.php");
I will see this output: Fatal error: Uncaught Error: Class 'ZipArchive' not found in /Applications/XAMPP/xamppfiles/htdocs/...
I use scripts like this because I need to call them and run unattended and they are working fine until I needed to include the ZipArchive class.
Why it can't find the ZipArchive class in cli mode?
I mention that if I run from terminal php example.php it is also working fine.
I spend several hours already trying to figure out, it is driving me crazy. Your help is really appreciated.
local server: XAMPP, PHP Version 7.4.25, macOS Big Sur
PHP CLI might have a different php.ini from what the "browser" version is using, so it might happen that an extension is enabled in one, but not in the other. I know this was the case in WAMP several years ago, so it might be the same in XAMPP too. Check what ini files are loaded by each version:
For the browser version:
<?php phpinfo() ?>
For PHP CLI:
php --ini
I'm trying to get a site up and running on a VPS server running cpanel.
I've uploaded the site and configured to point at the public folder which appears to be working (or pointing to the right folder)
However I'm getting a 500 server error. In an error_log I'm getting this error:
[18-Aug-2016 21:44:09 UTC] PHP Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() in /home/spadsdrama/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 351
SO it looks like PHP is missing this function?
PHP version is 5.6
Laravel 5.2
Pulling out my hair to get this sorted
I had this site working correctly on a Plesk server but switched to a Cpanel one (might be regretting this now!)
What am I missing - what configuration is missing?
Thanks
You need to install http://php.net/manual/en/book.iconv.php PHP extension for this function support. You can do this from ISP-manager of VPS, if it exists, or with SSH console server.
I have PHP 5.4.30 installed and running well using the FastCGI module and IIS 8 (on Windows 8.1). I have MySQL installed and would like to manage it with phpMyAdmin, however, I get this error whenever I try to access the page:
Fatal error: Call to undefined function mb_detect_encoding() in C:\inetpub\wwwroot\phpmyadmin\libraries\php-gettext\gettext.inc on line 177
Many older threads I have seen suggest adding extensions to the php.ini, but in the later versions of php, the php.ini file becomes php.ini-production and php.ini-development. Whenever I try to modify either of these files or create a php.ini file, I get an error 500 when trying to visit other php pages. I have also seen many solutions related to Xampp / Apache, but none of them seem to work in IIS 8 (that I have found).
Thanks in advance for any suggestions!
You probably need the php_mbstring.dll file installed. You can find it on the PHP Windows Extensions page
I'm migrating my CakePHP site from a local Xampp installation to an EC2 ubuntu environment. I moved over the DB, and copied the web directory files over to the EC2 instance, but upon accessing the site I get this error:
Fatal error: Class 'AppController' not found in /var/www/cakephp/lib/Cake/Controller/CakeErrorController.php on line 31
I looked into the Apache error log and found that the piece it wasn't liking was this:
$this->Auth->user()['role']
The error said the PHP parser wasn't expecting the '['. This all worked fine in the default local Xampp install, so I'm assuming this is a PHP difference between the two installs?
Xampp: PHP 5.4.7
EC2: PHP 5.3.10
Any idea of any settings or anything that could cause this behavior?
That is a new feature in php 5.4 see http://docs.php.net/manual/en/migration54.new-features.php the third bullet item.
For php 5.3 you will need to assign it to a variable
$user = $this->Auth->user()
$role = $user['role'];
I'm trying to install the mssql module for PHP on a server running CentOS 5.8 and PHP 5.3.5. I was able to get it working on the dev server which runs CentOS 5.2 and PHP 5.2.6, and everything seems to match up (FreeTDS installed, module in the modules folder, extension=mssql.so added to php.ini). However, the plugin won't load; doesn't show up in phpinfo() and I get an undefined function error on the test script.
Also of note: phpinfo() lists '--with-mssql=shared,/usr' under the configure command, which is really confusing me.
Solved. Not 100% what the fix was, but I'm pretty sure this was what fixed it.
First off, it probably didn't help I was trying to compile from a copy of php 5.3.16 instead of 5.3.6. Even then, I was running into errors trying to compile it. I found an fix that said to remove this line from php_mssql.h in the folder after it's phpized:
typedef unsigned char *LPBYTE;
I was then abe to do make && make install and it loads with no errors now.