Installing Apache Solr on Windows WAMP Server - php

I tried to install Apache Solr on WAMP server (in Windows) and I succeeded but the problem was that I couldn't use the PHP Solr library on this environment. The error I keep getting is:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.12/ext/php_solr.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0.
I've downloaded, included and activated the dll file containing the PHP Solr library but this error keeps comming.
PHP version: 5.4.12
Wampserver version: 2.4

First you need to make sure JAVA is installed on your windows machine; if not, make sure to download it from here https://www.java.com/en/download/
Download Apache Solr library from http://lucene.apache.org/solr/mirrors-solr-latest-redir.html
(to download older version go to https://archive.apache.org/dist/lucene/solr/)
Extract downloaded Apache Solr archive (i.e. in C:\wamp\apache-solr-4.0.0)
If you're setting up Solr to work with Drupal, you need to copy some additional files to C:\wamp\apache-solr-4.0.0\example\solr\collection1 [optional]
Launch Windows Command Prompt (to launch RUN press win+R on your keyboard, then type "cmd" without the quotes, and click OK)
In Command Prompt window; change directory to Apache Solr example folder location, i.e.
cd c:\wamp\apache-solr-4.0.0\example\
Also, in Command Prompt; type the following command java -jar start.jar
NOTE: Command Prompt should be kept open since Solr service is running. If you close it the service will stop.
This will start jetty webserver and deploy Solr automatically
Now you can access Solr GUI from browser by going to http://localhost:8983/solr

Related

Call to undefined function ocilogon() - IIS 7.5 - Windows 2008 R2 x64 - PHP 7.2.7

I am migrating a website from a development environment (Angular 4 - WAMP Server - PHP 5.6.35) to a production environment. In development, the Angular 4 application was successfully able to connect to a PHP script and run an Oracle stored procedure so there are no issues with the code.
In production, I've had to install PHP using the Web Platform Installer to successfully run a PHP site with phpinfo() showing 'PHP Version 7.2.7'. I run the application and when it attempts to run the PHP script, I get a 500 Internal Server error when the script is run. PHP error logs show:
<b>Fatal error</b>: Call to undefined function ocilogon() in <b>C:\inetpub\wwwroot\app\assets\scripts\php\pullData.php</b> on line <b>154</b><br />
Research has indicated that the issue could be:
Possible IIS configuration issue
Oracle Instant Client issue
OCI8 PHP Library not enabled
I think I've ruled out the IIS configuration as the front-end connects to PHP and runs the scripts without issue.
Oracle Instant Client 12.1 is installed and other applications can connect to Oracle. The PATH environment variable appears correctly set. I don't know if it is a 32-bit or 64-bit version - or whether this makes a difference.
I think this is the issue - the OCI8 library isn't enabled correctly. On the dev server, I was able to modify the php.ini file to uncomment (and enable) the dll, and phpinfo() showed the OCI8 library in the list:
extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
On production, I've had to manually add the 'extension=php_oci8_12c.dll' line (it wasn't uncommented out) and I've checked the EXT folder of PHP and the dll exists there. Phpinfo() still doesn't show the OCI8 library enabled.
Issue is fixed, and I took the following steps to fix it:
Uninstalled PHP (removed all PATH references and folders).
Uninstalled Oracle Instant Client using Oracle Universal Installer.
Installed PHP for IIS Express (and all dependencies) using the IIS Web Platform Installer.
Installed Oracle Instant Client 12c using automatic installer (winx64_12102_client.zip), not ZIP file. This way I didn't have to manually add PATH variables etc.
Checked PHP version (and if it was thread safe) using phpinfo(). Thread safety was (is) disabled. Downloaded the non-thread-safe (nts) version of php_oci8_12c.dll from windows.php.net (https://windows.php.net/downloads/pecl/releases/oci8/2.1.8/) and copied contents to EXT folder in the PHP install directory (which was in a parent folder of IIS Express).
Edited the PHP.ini files (php.ini-production and php.ini-development and php.ini) to include 'extension=php_oci8_12c.dll' or uncomment "extension=oci8_12c".
Restarted the server (probably unnecessary).
Opened CMD and ran the code 'php --ri oci8' to check OCI8 support is enabled and using the version of Oracle Instant Client that I just installed. Verified this also by using phpinfo().
Done. OCI functions now work.
This was a grueling process because this web server had multiple installs of Oracle Instant Client and the Web Platform Installer for IIS was buggy when installing PHP 5.6 and its dependencies. I was lucky that this time that the installer did not error out with PHP 7.2 as it originally did when installing PHP 5.6.

Where does PHP Composer store path to PHP binary?

My Windows 7 PC for some reason will not load the PHP cURL module regardless of which WAMP server software package I install. This isn't a huge issue most of the time as most libraries will use an alternative function.
My question is about this message I get in my terminal window when I run composer commands on packages that try to use curl....
PHP Warning: PHP Startup: Unable to load dynamic library 'G:\php\ext\libcurl.dll' - %1 is not a valid Win32 application.
Notice above in the error I get from composer it is referencing my G drive G:\php\ext\libcurl.dll. My current dev server and active PHP is located in my E drive here E:\Dev_Server\php
I checked my Windows PATH property to make sure a reference to the old G drive PHP wasn't stuck in there somewhere and it is not. My new E drive is in my path. So I am wondering where Composer is storing the G drive PHP reference so I can update that, any ideas?
PHP CLI (which Composer uses) and PHP WAMP (which, well, WAMP uses) use different configuration files. Composer by itself does not store anything about your PHP installation.
What to do: Run php --ini and php -i | more from command line (cmd.exe). Check which configuration files PHP CLI uses and check what is configured there. You probably will find references to your G: drive there.

install ext-zmq for ratchet push integration

I'm trying to install ZeroMQ for the push integration on Ratchet, I have successfully integrated Ratchet unto my Laravel 5 app. I downloaded and install the zeroMQ software and in the PHP binding instruction page, I followed the set up instruction for windows section since I'm on windows 10
Download the latest snapshot from http://snapshot.zero.mq/
Copy libzmq.dll into your php directory (e.g.
C:\wamp\bin\php\php5.3.8)
Copy the appropriate version of php_zmq.dll to your php extension
directory (e.g. C:\wamp\bin\php\php5.3.8\ext)
Add the following line to your php.ini:
extension=php_zmq.dll
since http://snapshot.zero.mq/ is a broken link so I look around the internet for other source and I found this link and downloaded the php_zmq-1.1.3-7.0-ts-vc14-x64.zip one. I copy the libzmq.dll to C:\wamp\bin\php\php5.5.12 as instructed as well as the php_zmq.dll to C:\wamp\bin\php\php5.5.12\ext and then I add
extension=php_zmq.dll
to my php ini and restarted my wamp server but it throws me this warning,
PHP Startup: Unable to load dynamic library
'c/wamp/bin/php/php5.5.12/ext/php_zmq.dll' - The specified module
could not be found
Any ideas, help please?
I downloaded the correct file from here https://pecl.php.net/package/zmq that match unto my php version and then restart my computer and now its working.
Get the version from here:
https://pecl.php.net/package/zmq/1.1.2/windows
In my case, the correct version that works was 1.1.2

SQLSRV works for CLI only but not from APACHE webserver

I am using sqlsrv to connect to an MS SQL database on my localhost without any problem. Recently, I have installed the 'sqlsrv' driver on a test server running Windows Server 2012 R2, that uses the same version of PHP as my localhost (php 5.5.19 - xampp).
Running database scripts from CLI of the test server works PERFECTLY fine.
eg: "D:\MYXAMPP\php\php.exe D:\MYXAMPP\htdocs\test\test.php" will connect to an mssql db, select some content and print it to screen without error.
However, same scripts complain driver not found when opened from Web interface. I tried checking php error logs, and i found a startup error
"PHP Warning: PHP Startup: Unable to load dynamic library 'D:\MYXAMPP\php\ext\php_sqlsrv_55_ts.dll' - The specified module could not be found.
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\MYXAMPP\php\ext\php_pdo_sqlsrv_55_ts.dll' - The specified module could not be found."
I tried restarting apache but same error keeps showing up. What could be the problem?
I found a solution this problem. It turns out the server environment Visual C++ Redistributable x86 version. As pointed out in this answer, the architecture of sqlsrv extension is x86, thus requires the x86 VC++ even on a x64 machine.
I noticed this when starting apache using a batch script distributed with xampp, instead of using the xampp control panel, a pop up would occur stating "Missing MSVCP110.dll", which I found was linked to VC++ 2012. I downloaded it from microsoft's website, and restarted apache without any errors. From there on SQLSRV has been working fine for both APACHE and CLI interfaces.
I still don't know why in the first place the CLI php API loaded the extension, while the apache php API couldn't in the same environment. I am researching that.

Mongodb running with node and PHP

I am new to Node.js and MongoDB. I have successfully got the mongoDB running with node.js and am able to start it up and store data inside of collections. So the server is already running on localhost:27017 and works when accessing localhost:28017 .
Now that I have it running and working within Node, I wanted to test MongoDB out with PHP on my Xampp server running on Ubuntu, but am not able to get the phpinfo() to say it is using mongo yet.
I have followed the steps here to configure and install the driver. I have moved the mongo.so file to my xampps extensions and added the appropriate line in php.ini + restarted. But phpinfo() still doesn't show it.
I guess i am confused on the aspect of where do i put the mongo-php-driver folder? is this installed into the Xampp server as well, if so where do i put it?
It is already running and working using node.js , so was just getting confused why it wasn't working properly or getting connected.
Also while I'm at it, Is it possible to have php and node.js use the same mongoDB server running on port 27017?
EDIT:
I was able to get the server to at least give me an error message about the file after i edited the extension_dir to the correct path
extension_lib = "/opt/lampp/lib/php/extensions/no-debug-zts-20090626"
i am now getting this error
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
i guess I needed to change that php.ini option to get it to load properly. but it seems I have compiled the wrong mongo.so build. I try again.
Thanks
According to this:
http://montenasoft.com/en/blog/how-install-pecl-php-extension-64bit-linux-while-you-are-using-32bit-xampp
Because xampp is compiled with 32 bit, but the mongo driver you compile is 64 bit.
You may have to compile your mongo driver with these:
phpize
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
make
sudo make install
Or just install apache2, mysql, php separately. I think this is a better option.

Categories