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.
Related
I have followed the instructions here: http://azure.microsoft.com/en-us/documentation/articles/cloud-services-php-create-web-role/#CustomizePHP for adding an extension but can not get the web role to recognize the extension.
Are you able to load other extensions? There was a bug in the past, see this post: http://social.msdn.microsoft.com/Forums/windowsazure/en-US/cd547ad3-c892-4ba4-82f4-c83690d18966/problem-with-loading-php-extensions
Also note that in order to load the php_ldap extension, it requires the following files: libeay32.dll and ssleay32.dll
Sorry for not coming back to you earlier. How are you getting along?
Since I never used a PHP based Cloud Service I did some testing for you. I followed the link you mentioned in your post with one exception: I did not add the php_ldap.dll to my Cloud Service.
After deploying the Cloud Service I verified a statement I remember about newer PHP installers for Windows:
They come with the required .dll files, like these for LDAP
They add the PHP folder containing the .dll files to your path variable
And this was indeed true. All required files are available and in the correct location.
This is the result I get when verifying LDAP from PHPInfo:
All seems to be ok. Can you try this and let me know how it goes.
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.
I have an existing linux server, with PHP already installed. I just need to add in the php_ldap module. I do not have root/sudo access (no yum/apt-get), what is the best way to get it installed?
Unfortunately there is none. Even if you get sources and compile it, you will still need to modify apache configuration to get it loaded. I suggest to talk to the admin of the server.
He didn't said that he use apache. Theoretically, if the sources of web-server and php is compiled as the user running the web-server, that should works.
I think it cannot be done without root privilege. If you cannot talk to your client you can look for a php library replacement instead. For example there is a JSON script replaceing the JSON extension.
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.
I need to enable the mcrypt functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the php.ini file. There does seem to be options for installing PEAR modules but a search told me mcrypt wasn't available. Is there any way I can do this, short of begging technical support to help me?
Update: Looking around a bit more, it looks like I might be able to use the dl() function to dynamically load a library at run time. Since I'm only using the mcrypt functions in one spot, I could probably get away with doing this since the performance hit (I assume there is a hit) should be minimal. The only problem now is how to get the libmcrypt.so file?
Another update: I've downloaded the libmcrypt.tar.bz2 file from Sourceforge and run ./configure, make, and then copied the libmcrypt.so.4.4.8 file into my home directory (as libmcrypt.so), but now I can't find where to put it so that the dl() function will find it.
The MCrypt Sourceforge page should have it
http://mcrypt.sourceforge.net/
To compile it just:
wget http://superb-east.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
sudo make install
EDIT:
Can you reference it with a direct path?
What have you tried?
Edit2: It seems that you can only load moduals from the extensions directory set in the php.ini and you cannot override extensions_dir with ini_set so you will either have to convince your host to install it or if they allow you to have your own php.ini (many do usually in [username]/php.ini) then you could set the extensions_dir in there and load the modual with that.
Really the best way is to tell your ISP to include mcrypt support. Even if you bundle your own PHP extension and load it with dl(), there is no guarantee it is going to work after a PHP upgrade, as PHP is sometimes very version-number picky.
dl() will not help you either, since it only loads libraries from certain paths, and those paths are usually only writable by the system administrators for security reasons.
I very much doubt that there is a way to use binary libraries without the consent of the hoster.
PHP in versions before 5.2.5 allowed you to use a path in the dl() function so that you could easily load libraries in a shared environment.
This changed for 'security' reasons with 5.2.5 and as far as I am aware your only option is to get your system administrator to add the module to the extensions_dir.
This issue is described at bugs.PHP.net