updating php to 5.3 not working - php

I get this error when using some library called: Mcrypt extension:
Fatal error:
Uncaught exception 'Exception' with message 'I cannot generate a secure
pseudo-random key. Please use PHP >= 5.3 or Mcrypt extension'
in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php:74
Stack trace:
#0 C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php(107): SecureSession->_randomKey(32)
#1 [internal function]: SecureSession->open('C:\xampp\htdocs...', 'PHPSESSID')
#2 C:\xampp\htdocs\PoliticalForum\User\User\headerSite.php(31): session_start()
#3 C:\xampp\htdocs\PoliticalForum\mainHome.php(14): include_once('C:\xampp\htdocs...')
#4 {main} thrown in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php on line 74
I found the class in this link:
secure session
I dont understand what version of php do I have!?!? and why hasnt the php updated, I have only updated my xamp to the newest version right now..
Note: there is no mistake in the class as it was made by one of Oreilly books' author and was used and recommended by a few people in here.

You can find your php version on the command line using: php -v
You can find out your php version, loaded extensions, and just about everything about PHP by putting the following in a file and calling it from your web browser:
<?php phpinfo(); ?>
Of course, don't leave that up on your production server.
As for the error, you need to find your php.ini, which will be at C:\xampp\php\php.ini and uncomment or add the line extension=php_mcrpyt.dll
You might want to have a peek in C:\xampp\php\extensions\ and make sure that dll actually exists. If not (and you have verified you do have PHP 5.3) you can go download the "Zip" version of the windows installer which matches your version, unzip it, and then simply copy that file to your extensions.
EDIT:
I had a look at the php manual for mcrypt and found this: "mcrypt is built in for PHP 5.3.x on windows, you don't need to do anything with a dll anymore."; I think it's entirely possible that you upgraded PHP to a different directory than your XAMPP install; check those versions (http://localhost should take you to the xampp panel where you can find phpinfo() in the sidebar)

If you get this message and you have PHP 5.3 or later. You have not in your php.ini file enabled the OpenSSL extension.
What you need to do is to have the following line in your php.ini file:
extension=php_openssl.dll
I asume that you are using windows, other wise change the extension accordingly

Related

PHP grpc extension not working on WAMP, despite working on CLI

After about a week of trying to install grpc for Firestore with PHP, I managed to get it working, however only when ran in terminals / cmd. This php.ini / environment is on my desktop in a folder and when executing files with firestore commands it works. No errors.
However, when in WAMP, it crashes the page with:
Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension. Please see https://cloud.google.com/php/grpc for installation instructions. in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php:76 Stack trace: #0 D:\wamp64\www\karma\vendor\google\cloud-firestore\src\FirestoreClient.php(139): Google\Cloud\Firestore\FirestoreClient->requireGrpc() #1 D:\wamp64\www\karma\functions.php(32): Google\Cloud\Firestore\FirestoreClient->__construct(Array) #2 D:\wamp64\www\karma\Firestore.php(8): Firestore->__construct('test') #3 {main} thrown in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php on line 76
Now what is really weird is that I copied the directory from desktop and literally pasted it into the WAMP PHP area and there is no difference. It even says in the config that php_grpc is loaded! I dont think the bottom dlls are needed so I don't think its an issue they're missing but I find it incredibly strange the same directory on the desktop will run php files from the command line but not in WAMP. WAMP is 64 bit and so is the plugin. PHP version of wamp was 7.0.1 but I replaced the whole 7.0.1 folder with the new 7.4.x version as with the plugin of that version.
Why would it say its loaded and yet say it isnt?
I too have have the same issue.I tried all possible ways to fix it.The extension is loaded in waamp but the php shows missing error.
I had to completely reinstall wamp to fix this error, in a new directory, reinstall php and made sure I had the correct grpc version. I have no idea what caused the error, but try every recent grpc version (I think there is four) and ensure that in your config file every addition copies the format.
I had a new php install outside of WAMP which worked, but as wamp has it's own that was bugged for me

PHP 7 SQLSRV driver doesn't load

I been trying to connect to my local MSSQL database using php.
Right now I am stuck at installing the correct drivers for php to work with MSSQL.
SO far I have:
1.Downloaded and setup Xampp
2.Downloaded the the SQLSRV driver at:https://github.com/Microsoft/msphpsql/releases/tag/v4.3.0
3.Placed the files within my extension_dir and double checked php.ini varible to point to the correct folder.
4. Manually added
extension=php_pdo_sqlsrv_71_ts.dll
extension=php_sqlsrv_71_ts.dll
to the list of extension within php.ini.
Yet I am still seeing the same Fatal error and a boolean checking if the driver has been loaded returns false:
bool(false)
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in
C:\xampp\htdocs\firsttest\api.php:9 Stack trace: #0 {main} thrown in
C:\xampp\htdocs\firsttest\api.php on line 9
Did I miss a step? I have been following different guidelines and some of them seemed outdated. I tried installing ODBC driver and the installer said that I had a higher version. Therefore I expect that shouldn't cause any problems.
By double checking everything I realize that Xampp always install as a 32-bit application. Therefore i should've taken the 86-bit version of the .dll files instead of the 64-bit.
Atleast this solved the problem for me.

Installing PDO driver for MySQL on windows

I am using quickphp to process my php file with was previously processed using wamp server. I also installed mysql for the database. I am using pdo with was working fine on wamp but i get this error while trying to access the site now.
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Users***\Documents***\includes\database.php:3 Stack trace: #0 C:\Users***\Documents***\includes\database.php(3): PDO->__construct('mysql:host=loca...', 'root', 'root') #1 C:\Users***\Documents***\menu.php(7): require('C:\Users\selfse...') #2 {main} thrown in C:\Users***\Documents***\includes\database.php on line 3
How can i install pdo driver for mysql. I have searched the net but still clueless.
It's a common problem, and one I've solved for a few people recently. Make sure you check the following list to ensure you have put them in place:
Ensure both php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll are in
your /ext directory. Ensure the following lines are present in your
php.ini file: extension=php_pdo_sqlsrv_54_ts.
dll & extension=php_sqlsrv_54_ts.dll.
Ensure you have installed VC++ redist located here. Make sure you download and install the x86
version regardless of the architecture of your OS otherwise this
will not work.
Check these things and come back to me with an answer.

Symlink for libxml2 not working after installing and configuring

I am currently have two PHP version in my server ;
PHP version 5.2.11 - the current version of the php in the server
wherein many programs uses it. Have libxml2-2.6.16 as libxml2 version.
Virtually Installed PHP
PHP version 5.4.44 - the virtually installed version of php in the server. Since, I upload my project in the server which uses Symfony
Framework. As symfony requirement, php version must be at least have
a php version of 5.3. And so, we installed this PHP version virtually.
After setting all the necessary configuration, we run it in the browser using its customize port. Unfortunately,the page gives this error.
Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 3070] CT 'container': The content model is not determinist. (in file:////home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd - line 20, column 0)' in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:96 Stack trace: #0 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(218): Symfony\Component\Config\Util\XmlUtils::loadFile('/home/sanchez/...', Array) #1 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/home/sanchez/...') #2 /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(48): Symfony\Component\DependencyInjection\Loader\XmlFileLo in /home/sanchez/ProjectName/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php on line 220
To understand more about the error, I research in the internet and find some related topics that may help. Then,, I found out that it is all about the libxml2, so I installed another libxml2 version in my directory (personal) and just use symlink for it to point to my directory. By the way I install, libxml2-2.8.0 as libxml2 version. I am also using RHEL4.After setting again the neccessary configuration , it still give the same error as above.
How can I solve this? Is it really possible to have two libxml2 version on the server? Do I miss any configuration or something? Is my libxml2 version and php version 5.4.44 is compatible? Or there is any libxml2 that is compatible with my php version? What should I do?
Appreciate any help.Thanks.

Codecept installation gives me an fatal error (bz2 extension)

I am trying to setup Codeception (v1.8) on my local development box (Windows 7 running WAMP).
I have PHP 5.3.13 running and both CURL and bzip2 are enabled modules, when I run the following command to install the 'framework' I get the following error:
php codecept.phar bootstrap
PHP Fatal error: Uncaught exception 'PharException' with message 'bz2 extension is required for bzip2 compressed .phar file "C:\wamp\www\codecept\codecept.phar"' in C:\wamp\codecept\codecept.phar:3
Stack Trace:
#0 C:\wamp\www\codecept\codecept.phar(3): Phar::mapPhar()
#1 {main}
thrown in C:\wamp\www\codecept\codecept.phar on line 3
......
I have 5.3 running so haven't installed the latest version of Codecept (v2) as that doesn't work with my version of PHP but cannot be sure why this is happening?
Any ideas
P.S I will be using this Codecept with Yii eventually if that makes any difference
I had the same problem and uncommenting 'extension=bz2.so' in my php.ini file fixed it.
the problem you have is because the v2 of codeception requires at least php5.4, downgrade to some of the 1.x versions than you will have no problem.
Here is the link for the versions

Categories