Can Run gnuplot via Command Line, but not via PHP Call? - php

I coded a PHP application that creates charts using gnuplot for specific client applications. It has run well for years.
I’ve just installed gnuplot on new iMac running Mavericks. I used MacPorts to do the install. The install went smoothly. I can access and run gnuplot successfully from the command line in the terminal.
However, when I attempt to run gnuplot via my PHP application, I get the following error:
dyld: Library not loaded: /opt/local/lib/libpng16.16.dylib Referenced from: /opt/local/bin/gnuplot Reason: Incompatible library version: gnuplot requires version 26.0.0 or later, but libpng16.16.dylib provides version 19.0.0
There are two things about this that are puzzling me at the moment:
Why would gnuplot give no error when called from the command line,
but would give this error in response to a PHP call?
Macports installed libpng #1.6.9_1. According to the libpng home
page (http://www.libpng.org/pub/png/libpng.html), 1.6.9 is the
latest version. Why would I get an error saying I need to update
libpng?
Does anyone have any thoughts on how I might fix this?
Thanks very much in advance to all for any info!

Related

Trying to get icu4c version 64 working with PHP 5.6 on Mac Catalina

I just got handed a big project running Symfony 3.4, and PHP 5.6, that I'm trying to get working on my "new" Mac Catalina (just purchased and installed, not upgraded from a previous macOS version), and I've gotten things working up to a certain point:
our-symfony-3-project $ bin/console server:start
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/opt/php#5.6/bin/php
Reason: image not found
zsh: abort bin/console server:start
I was able to fix a previous similar error with needing openssl 1.0.0 (I had to compile it from source using Homebrew then link it), and I think the solution is the same here, but it appears that I need to find the library or repo or download for icu4c version 64 (not sure I'm reading this right) to get brew extract to install it (it won't any other way), or figure out how to compile it and manually get it working for PHP 5.6, and I'm not finding the library I need apparently.
I've gone through pages and pages and probably a hundred command attempts trying to fix this error... and so far the recommendations have either been outdated (due to macOS/brew changes), or just didn't work.
I'd like to know where I can find the appropriate file/download/repo to just be able to install or compile this through brew or otherwise. PS: I know we shouldn't be using old versions but I just got this job and the company will not upgrade for a while.
I'm answering this by saying that I got the repo to work on a PHP 5.6 host using MAMP Pro (and Apache, not that that's relevant)... which already had the required libraries in question.
I went through the docs on the trial version (version 6.3.2):
https://documentation.mamp.info/en/MAMP-PRO-Mac/Settings/Hosts/General/
However, unlike Homebrew, switching PHP versions across hosts in MAMP Pro doesn't overwrite PHP symlinks like brew unlink and brew link does, I have to still edit my .zshrc file aliases and my PATH to have things like php (or pecl or pear etc) point to the MAMP Pro PHP version folders to get them to work correctly with the repos, as well as with composer (which runs the php command). Even MAMP's documentation says to modify the files yourself...
I can't tell yet if this difficulty is just natural to having multiple hosts with different PHP versions configured, as I could see how multiple variations running at the same time could conflict if they're using the same system files (like /usr/local files)... which sound like system software dependencies, and I don't know that these dependencies could be relegated to their own host folders (like /Applications/MAMP/bin/php/php5.6.40 folders), or maybe I just missed something somewhere. I'll update this answer if I learn better what to do here, or will add another answer if I find a way to do them using Homebrew better.

Web Platform Installer: Windows Cache Extension 2.0 for PHP 7.4 failed to install

If you try and install PHP 7.4 via Microsoft Web Platform Installer on Windows Server 2012, it installs the core PHP component but fails to install winCache and PHP manager.
I was able to install the PHP manager via a separate MSI. However, i cannot find an MSI for the wincache extension. If one tries to install the component via Web PI, the following error is thrown:
And if one tries to download the extension on its own via the official IIS website (https://www.iis.net/downloads/microsoft/wincache-extension) it instead redirects to an unrelated page.
Is it simply not possible to install PHP via Web Platform Installer anymore? The products have been listed since the 31st of January 2020 though the downloads seem to be broken now for months...
If you view the Wep Platform installer log. Then you will see this.
DownloadManager Warning: 0 : HttpWebRequest failure while trying to retrieve filename from fwlink http://sourceforge.net/projects/wincache/files/wincache-2.0.0/wincachewpi-2.0.0.8-7.4-nts-vc15-x64.exe/download. Error: System.Net.WebException: The remote server returned an error: (404) Not Found.
So that means the source link of Windows Cache Extension 2.0 for PHP 7.4 has been corrupted for a period of time.
When I access sourceforge.net to download the extension. I also notice that the link has been changed to
https://sourceforge.net/projects/wincache/files/development/wincache-2.0.0.8-dev-7.4-nts-vc15-x64.exe/download
So you can either download the extension here manually.
https://sourceforge.net/projects/wincache/
or post this issue to their vendor forum to ask PG to fix this.
Not 100% sure WinCache is released yet for PHP v7.4. They appear to be still asking for feedback: PHP 7.4 feedback
The latest release version I can find is wincachewpi-2.0.0.8-7.3-nts-vc15-x64 and this installs fine from Web Platform Installer. I'd suggest sticking with PHP v7.3.13 unless there is a compelling reason for PHP 7.4.x.
NOTE: PHP Manager fails to install with Web Platform Installer when installing PHP v7.3.13 but not a showstopper as PHP Manager v1.5.0 can be manually installed afterwards.

Laravel: Trying to generate pdf -> sh: 1: wkhtmltopdf: not found - Can I register wkhtmltopdf for the shell?

So I'm in the process of getting into a project that already exists, including hosting it.
I've got all the source code (have yet to transfer the files from the old hosting)
The webpage is hosted on a Plesk Onyx 17.8.11, OS Ubuntu 18.04.3 LTS‬.
Most of the website runs like a charm, sans anything that includes loading files and the generating of pdfs (maybe other stuff I haven't found yet).
When I want to generate a pdf (using a queue worker), I get the error sh: 1: wkhtmltopdf: not found in my laravel.log, which points to the line of code that catches any errors thrown in the pdf-generation.
wkhtmltopdf is installed via composer (and also in the composer.json), both in the project and globally. I already searched the web, and found the hint to use the binary option. However, since the codebase is not exactly small, and I know it runs fine on another host, I don't want to change all instances of generatePdf() to include the option. Because it runs on another server, it feels like there's some configuration I'm getting wrong.
Thanks in advance!
Update: I had to install wkhtmltopdf with patched qt, as described here, now it works like a charm.
Using the hint from #cOle2, I got wkhtmltopdf via apt-get instead of composer. This made wkhtmltopdf usable from anywhere and lead me to another error: The switch --footer-html, is not support using unpatched qt, and will be ignored.qt.qpa.screen: QXcbConnection: Could not connect to display\nCould not connect to any X display. This error lead me here, and reinstalling wkhtmltopdf as described there fixed the problem.
tl;dr Install wkhtmltopdf as binary WITH patched qt.

PHP Fatal error during a DreamFactory installation

I am pulling hairs here and choking kittens with frustration..
Trying to find a nice and easy framework to pull data from a MySQL server to my iOS and Android apps using REST-API and I found this little promising application called DreamFactory.
I had myriad of issues until I finally stumbled on this one while installing:
PHP Fatal error: Call to undefined function mcrypt_encrypt() in /opt/dreamfactory/platform/var/www/launchpad/vendor/kisma/kisma/src/Kisma/Core/Utility/Hasher.php on line 501
Has anyone encountered this during installation of DreamFactory and can advise me or alternatively another similar application?
you can run php -m to list which php modules you have installed. Here is the link to learn about mcrypt.
http://php.net/manual/en/book.mcrypt.php
installing with PECL
https://pecl.php.net/package/mcrypt
installing with homebrew:
https://gist.github.com/teroyks/e0d271e6720eda692456
Have you tried using the Bitnami prepackaged version including stack? It's literally turnkey:
https://bitnami.com/stack/dreamfactory

MongoDB PHP extension not recognized in command line script

I using a new server (Rackspace, Ubuntu 10.04) trying to run a php file via linux shell, and the file uses MongoDB to insert and store information being collected. I keep getting an error that is defined in the MongoDB library I am using: "The MongoDB PECL extension has not been installed or enabled"
When I run the same file/script in a browser window, it runs just fine.
A few things to note:
MongoDB php extension is installed and enabled (confirmed via phpinfo)
Using CodeIgniter with the MongoDB library found here: https://github.com/alexbilbie/codeigniter-mongodb-library
Using the CodeIgniter cron job bootstrapper extension found here: http://codeigniter.com/wiki/Cron_job_bootstrapper
I've used all of the above together on a previous, different server without issues.
I'm new to configuring a server 100% on my own, can anyone help me understand why the MongoDB PHP extension would not be recognized when run via shell, but work when accessed via http? Would it be an issue with my server configuration, or does the problem have to do with the libraries I am using?
Ubuntu has two php.ini, one for Apache one for command line. If I remember correctly they are under:
/etc/php5/apache/..
/etc/php5/cli/...

Categories