PHP mcrypt installing and setting up laravel environment issues - php

I am using Mac OS X Lion 10.7.5 and I want to clear one thing I do not want to use XAMPP, MAMP anymore.
So I enabled apache, php and installed mysql following this link. This work well. Then I downloaded laravel and installed it following this link. I copied laravel folder inside Sites folder which I created according to first link tutorial. Now when I click on public folder inside laravel folder it gives me following error
Unhandled Exception
Message:
Call to undefined function Laravel\mcrypt_create_iv()
Location:
/Users/zafarsaleem/Sites/learning-laravel/laravel/crypter.php on line 36
Then checked whether mcrypts are installed in phpinfo(). They are not there. To install mcrypt I followed this link. It worked until when I followed to PHP Extension title. When I downloaded PHP 5.3.8 is now the default since Mac OS X 10.7.3 unpacked and when I issue phpize command it gives me this error
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
What does this top level source directory of the module means? How can I make mcrypt install properly to make laravel work? Please help.

You will need to install Xcode and the command line tools extra package within Xcode, for then to install mcrypt
For more details, read this http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/

Related

MAMP with php extension intl on osx

I need to setup a project base on CakePhp FW, so I need to enable intl extension.
I followed this tutorial , but I always get make: *** [php_intl.lo] Error 1 even though I created symbolic link between MAMP and the directory containing XCode php development headers by using this command (after excute I got file exist result)
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /Applications/MAMP/bin/php/php7.1.6
I am not familiar with MAC OS, so please help
System Info
OSX: High Sierra 10.13.4
MAMP Pro 4
PHP 7.1.6
If you need more info, please let me know

Install PHP 7.0 Internationalization extension (Intl) on XAMPP on Mac

I followed the instructions outlined here:
Install PHP Internationalization extension (Intl) on XAMPP on Mac
Ran sudo pecl install intl
selected the correct files from the Cellar
then this error happened:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error:
'ext/standard/php_smart_str.h' file not found
include
^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed
No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h
So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....
re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.
I have php 5.5 on my mac, deep in the usr/local/bin folder
so next step was to get pecl to use those files and generate an intl.so file....
Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)
Ran php and came up with this error:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so'
- dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so,
9): Symbol not found: _zval_used_for_init Referenced from:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
Expected in: flat namespace in
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
in Unknown on line 0
I imagine it has to do with different versions?
In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?
Install intl.so in PHP 7 seems impossible?
After a lot of research I was finally able to resolve this. Detailed steps here:
before you begin, check which php path is set. it should be /Applications/XAMPP/xamppfiles/bin/php. If not you can change it by PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}". more detail here
Overall idea is to build the intl-extension from PHP source code on your own. Before you begin make sure you have installed Xcode. Also, install the latest version of autoconf. this might help:
brew install autoconf
Next download the version of PHP you use in XAMPP from php.net. I am using 7.1.18. This version worked for me: php-7.1.31, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well. Do let me know if it does or doesnt, I’ll update this post. Do not use PHP 7.3 for Magento 2.3.0, it is not supported.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
Restart your Apache using XAMPP GUI and it should work.
So far, it seems that extension intl.so for php is bundled with php
and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.
So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.
Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm
The error means that XAMPP doesn't have PHP compiled with intl. You may try:
pecl install intl
but probably it won't work as well.
See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.
As for the workaround, try installing memcached extension instead of memcache, e.g.
pecl install memcached
Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.
If you wanna try without homebrew, with native apache and php, look at my aswer here: https://stackoverflow.com/a/55131868/3692846

Unable to install composer

I am unable to install composer on my local system. Following are my local system and PHP details:
OS - Windows 8.1 Pro - 64 Bit OS - X84- based processor
I have installed XAMPP -
PHP Version 5.6.8.
On trying to install composer, it requested PHP_pdo.dll. However, I downloaded the dll and placed it into the xampp/PHP/ext folder
But seems some versioning issue. Where can I get PHP_pdo.dll for PHP Version 5.6.8 VC11 X84?
composer is installed using the PHP CLI (Command Line Interface)
The php.ini that controls the CLI is in your \xampp\php folder (its not the same one that controls PHP under Apache).
Edit \xampp\php\php.ini and make sure that
extension=php_pdo.dll
is not commented out, a comment has a # in column 1
That said, you had better get the original php_pdo.dll back that was in xampp\php\ext as there is no way of knowing if you put a good or bad new version in when you did whatever you did with the new one

Connect to RabbitMQ from PHP - Windows

I have RabbitMQ running on one of our servers and am trying to connect to it via PHP. I am developing on a Windows7 machine and my first line of code reads:
$cnn = new AMQPConnection();
It gives me the error:
Fatal error: Class 'AMQPConnection' not found in
I know that it is something that I need to install but what is it ? I am new to PHP so a little help would be nice.
Ps: I can connect to the RMQ server via the RabbitMQ admin web interface.
Thank you
Jack
Installation guide for php_amqp 1.4.0 (Stable version):
Download proper package for your php version from https://pecl.php.net/package/amqp/1.4.0/windows
Unpack php_amqp.dll to X:/php/ext/ directory
Unpack rabbitmq.1.dll to X:/Windows/system (not system32) directory
Modify php.ini file and add "extension=php_amqp.dll" line at the end of extensions list
Verify module installation by executing command "X:/php/php.exe -m" in command line
Restart webserver
I am developing on a Windows7 machine
You may be out of luck using that specific code. That class is from the PECL aqmp extension. Inside the installation instructions, it states:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
You will want to use another library to speak to your message queue instead.
The rabbitmq-c library supports windows now, and the php_amqp pecl extension builds on windows as well. The documentation just hasn't been updated, nor are there any official binary builds in the wild. However, I managed to get them to build and have some 32 bit dll's available for download here:
http://www.nathanjohnson.info/?p=77
# AMQP installation php.net:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
But here at RabbitMQ website is a windows installer...
Apparently this php.net page is outdated
To install do like this:
Download the correct package for your php from this official PECL amqp 1.4.0 page
unzip
add amqp.dll to your php ext folder
add rabbitmq.1.dll to your windows system 32 folder.
This according to the post on the blog I found here i think it is from the same #NathanJohnson who posted also here.
How I got it working:
My System Config: Win 7 Pro, (x64) XAMPP running PHP 5.6(x86)
Follow instruction from here to install RabbitMQ:
https://www.rabbitmq.com/install-windows.html
Now download compatible extension from here
https://pecl.php.net/package/amqp/1.4.0/windows
in my case it is "5.6 Thread Safe (TS) x86"
Now from zip file (php_amqp-1.4.0-5.6-ts-vc11-x86.zip) downloaded copy dll "php_amqp.dll" to your php extension folder in my case it is "xampp/php/ext" and copy dll "rabbitmq.1.dll" to "Windows\system" directory.
now register your php_amqp dll in php.ini file as
"extension=php_amqp.dll"
now restart apache.
Done. Now you should not get AMQPConnection not found exception.

Error Fatal error: Class 'Oauth' not found when using OAuth

I using code demo from link
http://djpate.com
When I run http://localhost:8080/test/OAuthProviderExample/client/index.php is it get error Fatal error: Class 'Oauth' not found in C:\wamp\www\test\OAuthProviderExample\client\index.php on line 2
in client/index.php i using:
$oauth_client = new Oauth("key","secret"); // line 2
$oauth_client->enableDebug();
How to fix it, i using wampserver in windows 7
remember there's one step in the tutorial:
sudo pecl install oauth
This is installing the oauth lib, in Windows OS it should be "oauth.dll" liked file, check where to get the lib file for Windows. and see if the problem solved.
I had this same problem. I think wamp installs using win32 bits by default. Even if you are running windows 64bit OS. So download the 86x version here For PHP version 5.5 .
Extract the Zip file and copy the php_oauth.dll found in your extract to C:\wamp\bin\php\php5.5.12\ext Click on your wamp server, goto PHP>php.ini, add thisextension=php_oauth.dll to a place where you find similar text or anywhere. Now exit your wamp server. Start it up again and in PHP>PHP extensions you should see php_oauth ticked. However, if you still encounter problems goto PHP error logto get a clue. Cheers!
Oauth for PHP 5.4 Windows x86
PHP/5.4.7
http://zahymaka.com/314/php-5-4-oauth-x86-windows
This is not my source so im not sure how stable ,but it was the only option I've found after about an hour and a half of searching.
Throw the file into your php/ext folder
Edit your php.ini to include the extension
extension=php_oauth.dll

Categories