Can laravel work without mcrypt? - php

Laravel works fine local, but on the server I get the following:
Laravel requires the Mcrypt PHP extension.
However I can't install mcrypt on my server because i have no admin rights. The process for installing the module at the server in my corporation would be to painful, it would be better to just go with another framework instead. But Laravel seems so modern and beautiful that I can't let it go without asking this question: Is it somehow possible to run Laravel without php-mcrypt?

No, Laravel really requires the MCrypt Extension.
You could, however, ask your hosting provider to install the MCrypt extension.
If you decide not to use Laravel, instead take a look at Symfony.
Symfony is another very powerful framework and Laravel makes use of quite some of Symfony's features.
Link: http://symfony.com/
Symfony doesn't require this plugin to be installed, however it requires the following plugins (but I assume those are installed at every hosting provider):
PHP >= 5.3.3
JSON enabled
ctype needs to be installed
The php.ini needs the date.timezone setting
I hope I helped you further :)
EDIT: Newer versions of Laravel don't need to have Mcrypt!

Yes, the Laravel composer.json file states that your application requires ext-mcrypt which can be faked by installing another package which states that it provides ext-mcrypt.
One you've gotten past the composer install, by default Laravel will still try to call mcrypt functions for encryption. But this can be prevented by creating your own encryption service provider that not require crypt.
I've created the package https://github.com/thomaswelton/laravel-mcrypt-faker.
You can use this to disable encryption for Laravel, or by using openssl encryption that you may already have available.
Note that disabling encryption is not at all advised for production applications. But the package may be useful when you just want to play around with Laravel without installing the mcrypt extension, or where you have the openssl extension available.

Installing dependencies on the wrong environment is now possible
The new --ignore-platform-reqs flag for the install and update commands lets you install dependencies even if you have the wrong php version or are missing one of the required php extensions. It's not really recommended but it can be useful sometimes if you want to run composer outside a VM for example and you only have the right extensions installed in the VM where you run the code.

Related

How to downgrade the php version to 5.6 from 7.0 in a symfony project?

I'm working in a project with Symfony Framework, but i have problems with php 7.0. Can I downgrade the php version or I need rewrite the entire application?
Symfony 3 requires at least PHP 5.5.9, so generally speaking, you can downgrade if you want. Of course you might have other limitations, like additional bundles and libraries you have installed and you might have used PHP 7 features inside your own code.
If you want to downgrade you can run:
composer why-not php:5.6
This will tell you which libraries you installed will not work with PHP 5.6. You might be able to downgrade them, but obviously this is not guaranteed and might require changes to how you use those bundles and libraries. For this you will have to check their upgrade guides and "undo" those changes.
For checking your own code you can use tools like etsy's phan to check for compatibility with a specific target version of php: https://github.com/phan/phan#usage

PHP Pear -- 'MDB2\Driver\mysql.php' missing

I've inherited a huge project, and I'm having a real time just trying to get the damned thing on its legs. Every time I run the project, amongst all the Strict Standards and Depreciated notices is one error:
Failed opening 'MDB2\Driver\mysql.php' for inclusion
From what I've read, DBMS drivers stopped being included in default Pear installations over five years ago... So how I can fix this so that either it doesn't use mysql.php anymore, or that my Pear installation DOES have it?
According to the Pear website, I just need to type: pear install MDB2_Driver_mysql but I'm wondering if it wouldn't just be better to change the code?
Thanks!
You say the project is huge, so I would suggest you don't rewrite it to use a different DB access library as that could push out your release date quite a bit and instead just install the required MDB2 driver.
To install the mysql driver, just do:
# pear install --alldeps MDB2_Driver_mysql
(and maybe consider using the mysqli driver instead)
If you do decide to migrate the project to use a different library, I'd suggest Doctrine as it is one of the mature DB libraries out there.
It sounds like you are trying to run PHP code written for an older version on a version of PHP that does not like some of the code.
Also see this for some insight on what you actually have to have installed on the PC running wamp in order to actually access a DB2 database. Are you sure you have all of this installed before you try to install via PECL?

PHP: How to check and install mysqlnd_qc

I would like to use this plugin because can cache the query results. But even reading the docs at
http://dev.mysql.com/doc/refman/5.5/en/apis-php-mysqlnd-qc.setup.html
http://www.php.net/manual/en/mysqlnd-qc.setup.php
still confused. Does it mean it comes with PHP 5.4 by default? If not, how I can I check if it's installed from CentOS using a command line? Also, how can I check if it's installed on my local PC running XAMPP with PHP 5.4?
Thank you.
As far as I know, none of the mysqlnd plugins are installed by default.
I've tried installing one of the mysqlnd plugins (in my case it was mysqlnd_ms), but I've had limited success. I concluded that I needed to build both the mysqlnd plugin and PHP itself from source to get it to work.
At that point I lost interest, because none of my clients are willing to build PHP from source for their environments. They want to use binary installs, preferably from a yum package repo.
I don't think these plugins will catch on as viable tools until they are installable in a more convenient way, for example through PECL or Composer.
Okay, based on this doc, PHP 5.4 has installed MySQLnd by default
http://dev.mysql.com/downloads/connector/php-mysqlnd/
and to test it using this answer
How to know if MySQLnd is the active driver?

installing Lingotip translate on Magento; php version conflict; would like to override

I have just installed Magento ver. 1.4.1.1 on our Ubuntu dev server and am trying to install the Lingotip translation extension.
I am receiving the error:
magento-community/Lingotip_Translate requires PHP (version >= 5.0, version <= 5.3.2), installed version is 5.3.2-2
Install Errors
No valid packages found
PEAR ERROR: install failed
I think there must be a fairly simple way to comment out this check code to allow the .2-2 patch to work, but I am completely new to Magento and am unable to find it anywhere in the codebase.
My question is, can someone show me either:
1) how to "override" this blocking code, or
2) how to install this "ready2paste" version of the lingotip code I found at the freegentoo site.
Thank you!
I don't believe that Magento is certified for PHP 5.3 There are a slew of issues with 5.3 on the Magento forums, the fixes involve hacking the core Magento code which isn't recommended.
I would suggest that you rollback to PHP 5.2 which will fix your immediate issue and be safer with Magento in general.
--------- EDIT ---------
If rollback to 5.2 isn't an option, you could download the package manually using
./pear download magento-community/Lingotip_Translate
and then exploding the tarball yourself. Place the app, skin and other folders as seems appropriate and go for it. Obviously, you are choosing to void your warranty in bypassing the installer, and your mileage may vary. good luck :)
You will need to have run ./pear mage-setup . in your magento install dir previously.

After compiling PHP from source are the devel libraries still needed?

After compiling PHP from source are the devel libraries still needed?
For example, I am building a newer version of PHP from source than is on our dev servers. I installed alot of [extension i.e. mysql, postgresql, curl, etc]-devel packages in order for the configure from the dev server setup to work. Do i still need these after php has compiled? For example could I make a distro and then distribute the PHP distro to another server without needing these devel dependencies?
I am a bit of a noob to this.
You don't need to ship the devel-libraries.
But my advice is to take some time and learn how the build system of your linux distribution works. And then build a new php package that can be installed by the package manager.
Take a look at how the "original" php packages were built for the distribution. Most likely you can simply copy and edit the existing rule file(s) and then make a new version of that package. This way you take advantage of the dependency mechanisms and the package manager will not remove/overwrite your version so easily when an update shows up in the "official" repositories.

Categories