Trouble installing composer for PHP 7 on windows to get PHPmailer - php

I want to add phpmail to my php Server. The server is a windows machine. I searched for it and found out that the best way to install it is with composer. I'm having trouble getting composer to install due to php.ini issues.
I am getting the following error:
*The PHP exe file you specified did not run correctly:
C:\php\php.exe
The php.ini used by your command-line PHP is: C:\Windows\php.ini
A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.
Program Output:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\php\ext\pdo_odbc' - The specified module could not be found.
in Unknown on line 0*
I tried searching the net for pdo_odbc but am not sure what I'm looking for. where can I get the missing dll?

I finally got composer to install. I had to first, rename the ODBC DLL from PHP_pdo_odbc.dll to pdo_odbc.dll. Then I got a message about SSL not being enabled. I first had to enable it in php.ini. Again I had to rename the DLL for SSL from PHP_openssl.dll to openssl.dll. Then Composer installed. Why did PHP install with the DLL's named differently than composer was expecting? Or is this a composer issue or the fact that it's PHP on windows? From there I installed PHPmailer and sent my first piece of mail. This is so much more complicated than coding in .Net

Related

PHP ZMQ Extension: Unable to load dynamic library

I'm working on Wampserver on Windows 10.
I'm using an extension called ZMQ. I downloaded the DLLS from:
https://pecl.php.net/package/zmq/1.1.3/windows
I previously used the version of the extension for PHP 5.6 and it worked. The extension however had a bug, so I decided to upgrade my php version to 7.0.4 and try the new version of the extension.
The extension was successfully installed and it appears in the phpinfo(), but when I try to run "php -v" from the command line (or the CLI service that uses the extension), I get the following error: "Warning: PHP Startup: Unable to load dynamic library 'D:/wamp64/bin/php/php7.0.4/ext/php_zmq.dll' - The specified module could not be found.
in Unknown on line 0"
The weird thing is the file "php_zmq.dll" actually exists in the specified path.
Important note: I have the line "extension=php_zmq.dll" in both my "D:\wamp64\bin\apache\apache2.4.18\bin\php.ini" and my "D:\wamp64\bin\php\php7.0.4\php.ini" (which to my understanding is used by the CLI). I can't remove either of those lines because then the extension is removed, or it doesn't work in the CLI.
I had the same problem. using PHP 7.0 x64 TS. I used the exact dll from pecl but same error. all my other extensions load fine and are in the same directory
i followed all instructions on https://superuser.com/questions/585291/installing-zeromq-on-windows-7-wamp-server.
the main updates would be to do the following:
copy libzmq.dll and libsodium.dll to php root dir. (both are found in the pecl zip files.

PHP Warning at startup while trying to load php_oci8.dll

I'm using XAMPP and trying to configure Oracle connection for sql.
I uncommented the line extension=php_oci8.dll and at first it ended up with an error (that oci.dll is missing), but later I downloaded instantclient from Oracle web pages. I tried with versions 10.2, 11.2, and 12.1 but neither worked. Obviously I've added the path to those libraries to my PATH env variable.
The warning I'm getting at the startup of Apache is: PHP Warning: PHP Startup: in Unknown on line 0
The error when I'm trying to connect is: PHP Fatal error: Call to undefined function oci_connect() in ...
I've tried with php_oci8.dll and php_oci8_11g.dll. Those files are in my php/ext directory (they were included in xampp), my instantclient is added to PATH and the warning doesn't show up if I disable those modules. I've tried restarting services and computer.
Can you help me find a solution how to configure it correctly? I'm using Windows 8.1 with administrative privileges.
BTW. My phpinfo() says that OCI8 is activated (but functions like oci_connect still don't work).
EDIT: When I tried running PHP manually I finally got the error to display what was wrong: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application. in Unknown on line 0 Can you help me find out where can I download a correct version?
There was a problem with 64bit version of instantclient. If you ever have the same issue, please install 32bit version of instantclient.
To be honest the easiest way is just to follow PROPER instructions: http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
I tried a lot of other advices and they all went really bad on me (not just because I used different bit version - also I copied the files everywhere following stupid advices and it was hard to correct it)
Its because your Oracle is 64 bit. Remove it and install a 32 bit version of Oracle client and it will work.
It looks like your extension are not install properly. Try to update it or reinstall it with pecl with
pecl install extname
You should also check extension_dir directive in php.ini and check if the PHP folder is added to the path
There's an alternate way to solve this: Install the full Oracle Client, not the basic zip, you can get it at oracle site (about 1Gb):
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-windows-3633015.html
Im using Windows 10, Apache 2.4, PHP 7.1 (all x64) and it works. Also tryed PHP 5.6 and it works too. Still use the php_oci8_11g.dll from the basic client zip to match your php and system version.
You can search the site to find older client versions (11g, 32bits, etc) but Im working with de 12c client and accessing an Oracle 11g enterprise server.
I found a lot of occurrencies of this same error all around, but none gave me this solution. Hope taht helps.

PHP loading extensions error

I'm trying to get PHP to load some extensions (sqlsrv driver for PHP PDO).
I'm using a wamp server, With PHP 5.4, Apache 2.4.4.
In my PHP.ini file, i've entered the following line:
extension_dir = C:\wamp\bin\php\php5.4.16\ext
...
extension=php_pdo_sqlsrv_54.nts.dll
However in the apache error log, whenever I restart the apache service, I get the error message:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_pdo_sqlsrv_54_nts.dll' - The specified module could not be found.\r\n in Unknown on line 0
Now, I know for a fact, this error is incorrect. If I copy the file location directly from the error log, (C:\wamp\bin\php\php5.4.16\ext\php_pdo_sqlsrv_54_nts.dll) and paste it into windows explorer, it finds the file fine.
I've added the ext directory to windows PATH environment variable, still no success.
Any ideas what to try next?
Thanks
Your problem is that you are trying to run a NTS 'Not Thread Safe' dll with a PHP that is 'Thread Safe', so initially try downloading the Thread Safe version of the sqlsrv DLL.
BIG NOTE and possibly your next problems solution:
As far as I know the sqlserver database interface dlls are only available as 32bit. So if you have installed the 64bit WAMPServer you will have to uninstall and install the 32bit WAMPServer.

phar Class not found

I am trying of install the dependency manager for php "composer", but "composer" needs the extension "phar". I've realized php6 comes with phar by default, but is disabled and not necessary in order to execute "phar" files.
When I try execute "composer.phar" (in the cmd: php composer.phar) it throws the error:
Fatal error: Class 'Phar' not found in composer.phar on line 13.
If I try to execute the Composer installer, "installer.php" (in the cmd: php installer.php) throws this error:
Some settings on you machine make composer unable to work properly. Make sure that you fix the issues listed below and run this script again:
The phar extension is missing. How can I fix this?
Should I install it or recompile php without --disable-phar I am using appserv 2.6.4 (apache 2.2, php6, mysql 4).
You really shouldn't use cutting edge theoretical software. PHP6 doesn't actually exist. Downgrading to a more realistic version of appserv would solve your problem. But if you insist on using 2.6.4, you should do the following:
check that phar.so exists in the php extensions directory. If not, you need to install that extension.
if it exists, check if it's listed in php.ini as extension=phar.so. If it's not, add that line.
if it is, check that it's listed in the php.ini that command line PHP uses, too. Command line PHP and web PHP sometimes use different php.ini files, and while one might have phar.so activated, the other might not.

CentOS - Mongo class not found in PHP

I need the MongoDB PHP driver on my CentOS 5.4 machine. My PHP version is 5.1.6. I downloaded the RPM and installed it. That created several files in /usr/bin directory. I copied
/usr/bin/mongo
to
/usr/lib/php/modules
which was what extension_dir showed on doing phpinfo();.
I also added
extension=mongo.so
in /etc/php.ini.
However on executing my PHP script, i still get
Mongo class not found.
What's going wrong here ?
Also, my phpinfo() shows PHP version 5.1.6 whereas running PHP from command line shows 5.3.3. Could anything be wrong with that ?
Thanks in advance.
You're saying your webserver and command line PHP report different versions. These are going to be installed in different locations, and their extensions are API incompatible with each other.
When you installed the php_mongo extension, it may have used the command line php to determine the directory to install the extension to.
Make sure you have the correct php_mongo for the php version of your webserver, and it is in the correct extensions directory. (get the directory from the php.ini returned by phpinfo())
I hope you realise PHP 5.1 is also many years out of date. Unless you have a specific reason to use a version that old, you should also look at upgrading to a more recent version.
Edit:
Just read your comment "I must also mention that /usr/bin/mongo is a binary executable file but its not having a .so extension. Im copying it as is to /usr/lib/php/modules"
No no no! :)
This is the mongo command line client. This is not the PHP extension!
You can run a find /* -name "mongo.so" to see where the installer put the file, this will probably also give you an indication of which version of PHP it was installed for.
It looks as though you are confusing the RPM-packages for the MongoDB server with the requirements to install the MongoDB PHP driver. The PHP driver provides access to the server from your PHP applications, and does not install any command line tools.
restart httpd !
yum service httpd restart

Categories