How to get memcache to work on php with Windows - php

I am trying to get memcahe enabled on my Phpinfo().
Hi everyone, I am a newbie when its comes to working with memcache. So I have been trying to get memcache enabled on my php, but I have had very little luck.
According to my phpinfo() my php build version is API320190902,TS,VC15 and entails that I have to enable php_memcache.dll which is of the same VC (i.e VC15).
I have done that, by placing the php_memcache.dll file in my php/ext folder and enabling the extension in my php.ini by stating "extension=php_memcache.dll". But despite doing all this, I can't seem to get the memcache enabled, and my phpinfo() does not show the desired memcached section.
Additionally my Apache log states
PHP Warning: PHP Startup: Unable to load dynamic library
'php_memcache.dll' (tried: C:\xampp\php\ext\php_memcache.dll (The
specified module could not be found.)"
Can someone kindly help me figure out where I am missing it, or not doing right?
By the way, I tested this on Xampp and the .dll file was downloaded from the link https://github.com/nono303/PHP7-memcache-dll
Attached are screen shots of my Apache logs, php.ini, php/ext and phpinfo().

There are common things that are often encountered in PHP and Memcache(D) related issues:
Do you need the MEMCACHED or the MEMCACHE extension?
Is the MEMCACHED server already running? (in your case, that's not the problem yet)
Is the installed PHP extension x64 and Threadsafe compatible (as your system requires by looking at your phpinfo).
Personally, I use another PHP extension which works perfectly under PHP7 and PHP8:
memcached 3.2.0 for Windows
https://pecl.php.net/package/memcached/3.2.0/windows
Note: in addition to the usual DLL extension that you will copy to php/ext/ (and enable in your php.ini), you will also need to copy libmemcached.dll and libhashkit.dll to a directory belonging to your system path.

Related

What library do I need for 'pg_connect()'?

I'm trying to connect to another database within a wordpress plugin. Inside the main php file, I tried to call 'pg_connect($con_string);' but I now realize that this function is undefined. Is there a library that I need to include somewhere in the directory? Thanks.
This function is in the php-pgsql package or module. Not sure what OS you are on, but on some Linux distributions the package has version-specific naming like php5-pgsql or php7-pgsql so you might need to install the version specific to whatever PHP version you're using. You can use phpinfo() to output information that will help you troubleshooot what is going on, including versions and what packages are enabled.
The package may need to be installed, or it may be installed but disabled. It is enabled by default in PHP >= 5.3.x. If you're finding it is not included by default, you likely either have a very old version of PHP, or one that is custom-configured not to have this package enabled.
If the issue is enabling it, look in the configuration files. On some systems there is a file installed in /etc/php.d/ like 20-pgsql.ini with a line that will enable the extension. In other systems it is in php.ini which is usually somewhere in the /etc directory. Search these files for a line containing the text pgsql and make sure it is enabled. Then restart the web server (or PHP-FPM if you are using that.)
Hopefully this will address the issue.
If you need further help, the official PostgreSQL documentation is a good resource:
https://www.tutorialspoint.com/postgresql/postgresql_php.htm
And beyond that I would recommend a web search including your specific distribution and possibly PHP version, as this will return information with the correct configuration file locations and options.

PHP install mailparser extension

I want to install mailparser extension.
I downloaded php_malparse.dll ( put it to php/ext folder).
Also added : extension=php_mailparse.dll to php.ini
But it doesn't work, and php_info() doesn't show it too.
In logs I get:
PHP Warning: PHP Startup: Unable to load dynamic library 'E:\xampp\php\ext\php_mailparse.dll' - %1 \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd\xef\xbf‌​\xbd\xef\xbf\xbd\xef‌​\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd Win32.\r\n in Unknown on line 0
I need help, how can I solve this problem?
Thanks!
It's difficult to say what's going on here. Typically the message Unable to load dynamic library means the library (in this case on Windows the .dll file) is not correctly formatted and the OS was unable to map it into memory or PHP was not able to use it.
Some possible reasons include:
The extension was not compiled for the same architecture as the target PHP build (e.g. the PHP is x86-64 but the library is x86)
The extension was not compiled using the same runtime version; PHP is pretty strict about this (e.g. PHP5 is built with vc11 on Windows, PHP7 is built with vc14, ETC.)
The extension was not compiled against the same version of the PHP API or extension API used by your PHP build; typically PHP will show a more-detailed error message when this is the case (it's strange that your error message contains a bunch of non-printing characters though...)
To double-check all this, view a dump of phpinfo() to see what kind of PHP you have. Look for the PHP API and extension versions as well as the system architecture and whether thread safety is enabled. Then return to where you downloaded the php_mailparse.dll extension library and make sure the extension aligns with your PHP build. Here are some official instructions for this process for Windows PHP extensions.
I found official builds of this module here. There are a lot of different choices to pick from. Pay attention to ts (i.e. Thread-safe) vs nts (i.e. Non-thread-safe), x86 vs x64 (i.e. the architecture) and vc11 vs vc14 (i.e. the runtime version). You may have to experiment until you find one that works for your PHP build.
It might also be worth checking out the official install instructions for the mailparse extension. Note especially that the mbstring module has to be loaded first for it to work.

Cant get memcache to work using xampp/php

Im on Windows 7, 64/bit running xampp v3.1. The php version is 5.4, Im trying to install memcache locally on the box so I can use memcache with php. I have searched google and followed directions about installing memcached.exe as a service, then downloading the memcache dll extension file for php and putting it into the ext folder under the php folder. I then add it to the php.ini folder, restart apache and memcache does not show up when running phpinfo() and when I try to run memcache via php it tells me this function does not exist. Can anyone help me figure this out? I verified the service is up and running, I tried different versions of the dll php extension file but still same issue. Any suggestions? Here is one site I used for instructions on installing memcache:
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/
There must be some error logged into your apache logs. What is the error?
Looks like I grabbed the incorrect version of memcache for php. You must grab the correct memcache dll file for the php version you are using. I found the correct download here:
http://windows.php.net/downloads/pecl/snaps/memcache/3.0.6/php_memcache-3.0.6-5.4-ts-vc9-x86.zip
It has the correct php version, 5.4 and its thread safe. Once I downloaded it, extracted the dll and put into php extension folder and restarted xampp/apache, it now works.

Cannot find php_sqlsrv extension - 5.3, threadsafe

I've followed the answer to this question to the letter:
Connection between MSSQL and PHP 5.3.5 on IIS is not working
I'm using XAMPP with threadsafe 5.3. I've copied the files to the extension directory (while leaving them in the /php folder) and I've added the extension lines:
extension=php_sqlsrv_53_ts.dll
extension=php_pdo_sqlsrv_53_ts.dll
When I do this, Apache fails to start, giving me errors in eventvwr like:
Application popup: Warning : PHP Startup: Unable to load dynamic library
'C:\xampp\php\ext\php_sqlsrv_53_ts.dll'
- The specified module could not be found.
Except, obviously, that that file DOES exist in that spot, and php.ini is pointed at that extension directory.
What's the problem?
Windows reports this when a shared lib dependency of what you're loading is missing. Use depends.exe to view the dependencies of php_sqlsrv_53_ts.dll and make sure it's either previously loaded or in the shared library search path.
http://www.dependencywalker.com/
See below url
php_sqlsrv.dll: gives error when checking PHP version but extension works
Read it:-
Since PHP 5.3, Microsoft has a new driver for windows :
http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx
Maybe you can try this version, which seems quite recent (06/2011)
Hope that helps !
Sadly, none of the answers addressed the issue or were avenues I had already explored.
I have decided to use the ODBC drivers with a SQL Server connection string, which seems to work fine, minus the fact I can't use MSSQL and SQLSRV native functions.
I have written a page that might help when installing the SQLSRV driver:
http://robsphp.blogspot.co.uk/2012/09/how-to-install-microsofts-sql-server.html
Unfortunately the instructions got complicated when MSFT removed the download for the old XP/2003 driver (version 2.0), so read the whole page before starting.
Wrong technology, but I was having problems getting WAMP to connect to MSSQL, with the same types of errors.
I fixed the problem by installing the 32-bit version of WAMP (instead of 64, even though we were on a 64-bit system).
Even if that's not applicable to the OP, I hope someone finds this helpful!
I was getting the same error messages when I started the Drupal 7 stack after installation. I am using VM Ware with Win 7 x64 and acquia-drupal-win-7.31.36-6159.54300.
I went to the PHP site http://php.net/manual/en/sqlsrv.requirements.php and installed the x64 Package.
steps
1) Stop Drupal Stack
2) run the file: sqlncli.msi
3) restart Drupal, and no error messages.

Why mysql driver is not currently installed Error is coming on Local Server?

I have a php project developed using zend framework, when i hosted to my local server(CentOS) i got the
below error:
The mysql driver is not currently installed
I have installed and enabled pdo_mysql on php.ini, but it is not effected my phpinfo.
Phpinfo only show pdo_sqlite not see pdo_mysql.
Another issue in my machine is phpinfo shows PHP version 5.2.8 and from terminal it shows PHP 5.1.6. Are there two php version running my machine?
Help is highly appreciated.
Check your phpinfo() output for the location of the php.ini file used and make sure to adapt that file. It's perfectly possible to have multiple versions of php running on a single computer.
It will show near the top of the output as (here's mine):
Loaded Configuration File /etc/php5/apache2filter/php.ini
that would be the location of the file you need to edit to affect your webserver instance php behaviour.
make sure to extension=php_pdo_mysql.so in it to load the mysql pdo driver
finally also make sure that extension_dir points to the directory where your libraries are found, using an absolute path; you can find that in phpinfo() under Core (and in your php.ini when you want to adapt it obviously)

Categories