intl php extension exception zend framework 2 shared hosting - php

I finally managed to deploy my ZF2 site to a shared (and also free) hosting.
Everything seems to be working the right way, except a section that has a form.
This is the error I'm getting:
Uncaught exception 'Zend\Form\Exception\ExtensionNotLoadedException'
with message 'Zend\Form\View\Helper component requires the intl PHP extension' in
/.../vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormMonthSelect.php
In the form, there's a field where the user is supposed to select his/her birthday. I think that the problem is there.
How I'm i supposed to enable that extension in the server? Or at least, modify something in my zf2 application so it doesn't need that extension?

Your diagnosis is correct -- FormMonthSelect does require intl extension.
Managing php extensions is usually something done by sys admins, so you'd either ask the hosting company to enable it or try to squeeze that in through htaccess (iffy, edit .htaccess to load php extension?). Other then that I can only advise not to use anything that relies on intl, so maybe a simple text field with date parsing done by you manually.

Related

'rpath' does not working in some linux system.

I made a PHP extension for PHP Apache Module.
I compiled it using gcc-4.9.2.
So I distribute my PHP extension with libstdc++.so.6(libstdc++.so.6.0.10) in same directory.
And I compiled the extension with 'RPATH=$ORIGIN'.
Most linux system is OK to run.
But, some system(my customer system), extension try to load /usr/lib64/libstdc++.so.6, and fail to load the extension.
'ldd command' result is fine, it correctly find libstdc++.so.6.0.10(not /usr/lib64/libstdc++.so.6)
'$LD_LIBRARY_PATH' is empty.
I have had search so many thing using google, but I don't know why, and I don't know how fix it.
Anybody knows, What is the problem?
"6.0.10" is rather old. Perhaps the customer system's libstdc++ has the same soname but a later version.
Normally you would make a shared library extension using a different soname to avoid naming conflicts.

Disabling a PHP extension the easy way?

I am using an open source library ( http://hybridauth.sourceforge.net ) that does not support the PECL OAuth extension of PHP. If you try to run code with it, it says "Exception: Hybridauth Library not compatible with installed PECL OAuth extension. Please disable it."
Easier said than done.
I am hosting my site via Amazon AWS Elastic Beanstalk ( https://aws.amazon.com/elasticbeanstalk/ ). I chose this solution because it allows you to get started quickly with no configuration, no SSH, no custom AMI, ...
Which means I can't easily modify the original php.ini file or delete the extension file.
Is there an easier way? Disabling an extension on the fly? Via a php method? Via an htaccess file? A trick?
No, you cannot disable extensions via PHP method call. In the past you could add it (with dl()), but even then, you was not able to remove any added without playing with ini file.
The short version: No, not in any practical sense.
If you have runkit available you should be able to remove the functions or objects that the module defines, but it really depends on why HybridAuth have trouble working when the PECL OAuth extension is installed. This is not suggested for anything close to a production environment.
You can ssh into your instance very easily if you have your pem key. Just go to the ec2 console, select your instance and click "connect" in the toolbar to get the address. Then you can modify any of the files on the server.

Enabling php sysvshm extension without recompiling

I am using a shared host. PHP is compiled with --disable-sysvshm. I get the following error while running a script:
Fatal error: Call to undefined function shm_attach() in ...
Is there any way to enable it without re-compiling php?
There is, but as a regular user, you can't do it. You'll need admin access.
If you have root access, then your package manager should have the extension available if it doesn't come built into PHP. For SuSE, it's looking like a php-sysvshm package would do it. If there's no package, you'll still need to rebuild, but it's doable.
If you don't have the access you'd need to build PHP or install packages, you won't be able to build or install, let alone load, extensions (which are pretty much the only way you can add functionality without replacing your existing PHP). In that case, you'll need to talk to your web host and see if they will install it for you. If they won't, then that's pretty much it.

Pure PHP implementation of SQLite?

Is there a pure PHP implementation of SQLite that will run on PHP 5.1.6? I am working on an application that would benefit from being able to store data in a relational database, but the server that it has to run on is stuck with PHP 5.1.6 and has been configured "'--without-sqlite"
I have no control over this server; cannot recompile, upgrade or otherwise modify PHP aside from using .htaccess files. Hosting externally is also not an option, unfortunately. MySQL may be possible but would be a nightmare trying to get their IT to create a database for me. (It took them 6 weeks to get .htaccess files enabled because of red tape and other things)
Am I out of luck? My fall back is to write everything to flat files but I really would rather not do that.
EDIT: Fixed typo. PHP does not have the SQLite extension and was configured "'--without-sqlite" according to the output of phpinfo()
Actually, you could easily download and install sqlite in your userspace, whether on windows or on a linux remote shell doesn t usually matter unless your host is unusually restrictive, if that is the case you should change service provider.
Once sqlite is installed, you can one of the available pear extensions or pecl extension to allow easy access through php.
Tutorial and code examples for the pear solution here.

XML-RPC with PHP and GoDaddy? Confusion sets in

I am attempting to work with XML-RPC via PHP on a GoDaddy server.
This same server is hosting a Wordpress Blog that makes use of XML-RPC and is functioning, though that may be unrelated...
Whenever I attempt to use any functions that are integrated into PHP for use with XML-RPC, I get an error (function list here: http://us3.php.net/manual/en/ref.xmlrpc.php) e.g.:
Fatal error: Class 'xmlrpc_client' not found
Is this because XML-RPC's PHP functions are not enabled on my server? If so, how do I go about enabling those - it would seem I would have to install the XML-RPC library to do so and of course I cannot do that on a shared server. Doesn't Wordpress use the same batch of XML-RPC functions though (it works fine)?
I think I have managed to thoroughly confuse myself. I have zero experience with XML-RPC.
The first point you made regarding the same server hosting a site supporting XML-RPC, is quite odd, as XML-RPC is enabled at compile time. There are no directives to be used in the php.ini file, and you therefore couldn't enable XML-RPC at run time using ini_set(). This would point to either a different server or several PHP instances running on the same server.
Either way you need to have this extension enabled at compile time, which is out of your hands. So you would have to contact somebody at GoDaddy to get this working.
An alternative to that, would be to look at something like Zend_XmlRpc which is well supported and doesn't require the PHP XML-RPC extension to work.
Good luck.

Categories