loading specific lib locally for php composer - php

I am in the process of setting up Attendize parallel to Wordpress on my webspace,
server details:
Operating System: Linux
Software: Apache/2.4.54 (Unix)
MySQL version: MySQL Community Server (GPL) v5.7.38
PHP Version: 8.0.26
all works fine, except one process with "nitmedia/wkhtml2pdf": "dev-master". when running the function _render() I get
[2023-01-18 05:51:44] production.ERROR: Error generating ticket. This can be due to permissions on vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib. This folder requires write and execute permissions for the web user
[2023-01-18 05:51:44] production.ERROR: Error message. System error /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-amd64: error while loading shared libraries: libgio-2.0.so.0: cannot open shared object file: No such file or directory
[2023-01-18 05:51:44] production.ERROR: Error stack trace#0 /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php(1047): Nitmedia\Wkhtml2pdf\Wkhtml2pdf->_render()
#1 /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php(243): Nitmedia\Wkhtml2pdf\Wkhtml2pdf->output()`
libgio-2.0.so.0 is missing. , no PDF output of course
since its a rented webspace, I cannot run any packagemananger or write into the root dir.
So I tried to load the missing lib from local file. The acquired .deb got unpacked and x86_64-linux-gnu contained libgmodule-2.0.so.0 which I copy to same dir as composer.json.
in the php.ini I added extension_dir = "./"to load libraries locally from same dir and extension=libgio-2.0.so.0 to load it.
when running composer I get
PHP Warning: PHP Startup: Unable to load dynamic library 'libgio-2.0.so.0' (tried: ./libgio-2.0.so.0 (./libgio-2.0.so.0: cannot open shared object file: No such file or directory), ./libgio-2.0.so.0.so (./libgio-2.0.so.0.so: cannot open shared object file: No such file or directory)) in Unknown on line 0`
if I change the location of the file and the extension_dir accordingly, I keep getting this error.
I have also tried to zip it up and let composer load it from local repository with composer.json, goes thru, but does nothing.
So how (also in what format) can I load this specific lib locally? (via php.ini, or composer integration)

Related

PhpStorm - Synology - CLI Interpreter - Updates

I want to create a new project in PhpStorm, but I can't figure out why I can't add a PHP Interpreter in PhpStorm 2020.1.1.
First some info:
All is starting from my Synology NAS DS415+ with latest DSM 6.2.3-25426.
Installed on NAS:
Web Station
MariaDB 10
phpMyAdmin
PHP 7.2
PHP 7.3
Apache HTTP Server 2.4
SSH-connection is added successfully in PhpStorm.
Z-driveletter is /web-folder.
So, first things first. I created a /composer folder inside my /web folder. Composer.phar is selected in path as you can see.
Then I would select a PHP Interpreter.
I will add a new interpreter, so I click on +-sign.
Because of all is installed on my NAS, I select "From Docker, Vagrant, VM, WSL,Remote,..."
Then I select SSH because I can access my NAS through SSH.
Within SSH configuration I select mine. Test Connection => Successfully connected!
Now, I needed to enter the PHP interpreter path. I've searched on my NAS and found these paths:
/volume1/#appstore/PHP7.3/usr/local/bin/php73
/volume1/#appstore/PHP7.2/usr/local/bin/php72
However, I can NOT browse to these paths or enter one of these paths in the input-field.
Do or did I something wrong?
Could anyone help to get this works?
Update - 06/23/2020
I've created a phpinfo file.
What I've see is that my PHP.ini file path = C:\Windows.
I think that's not the intention? I need my NAS PHP.ini!
How can I configure this?
Update - 06/27/2020
I've created a log file that you can find over here:
2020-06-27 13:41:49,202 [13856671] DEBUG - sh.config.OpenSSHConfigService - Failed to parse OpenSSH configuration file: C:\Users\User\.ssh\config
java.io.FileNotFoundException: C:\Users\User\.ssh\config (System can't find specified file)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/java.io.FileReader.<init>(FileReader.java:60)
at com.intellij.ssh.config.OpenSSHConfig.parseFile(OpenSSHConfig.java:91)
at com.intellij.ssh.config.OpenSSHConfigService.a(OpenSSHConfigService.kt:57)
at com.intellij.ssh.config.OpenSSHConfigService.a(OpenSSHConfigService.kt:52)
at com.intellij.ssh.config.OpenSSHConfigService.getConfig(OpenSSHConfigService.kt:29)
at com.intellij.ssh.RemoteCredentialsUtil.connectionBuilder(remoteCredentialsUtil.kt:33)
at com.intellij.ssh.RemoteCredentialsUtil.connectionBuilder$default(remoteCredentialsUtil.kt:27)
at com.intellij.ssh.RemoteCredentialsUtil.connectionBuilder(remoteCredentialsUtil.kt)
at com.intellij.ssh.ui.unified.SshCredentialsEditorEx$1.a(SshCredentialsEditorEx.java:68)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-06-27 13:41:58,050 [13865519] DEBUG - ellij.ssh.SshConnectionService - Creating sftp channel within SshjSshConnection(<crc32=1xag9ud>#<crc32=hwmx1i>)#54eb5487
2020-06-27 13:41:58,061 [13865530] WARN - net.schmizz.concurrent.Promise - <<chan#16 / open>> woke to: Opening `session` channel failed: open failed
2020-06-27 13:41:58,061 [13865530] DEBUG - ellij.ssh.SshConnectionService - Creating sftp channel within SshjSshConnection(<crc32=1xag9ud>#<crc32=hwmx1i>)#2c5f9c31
2020-06-27 13:41:58,062 [13865531] INFO - .channel.direct.SessionChannel - Will request `sftp` subsystem
2020-06-27 13:41:58,069 [13865538] WARN - net.schmizz.concurrent.Promise - <<chan#6 / chanreq for subsystem>> woke to: net.schmizz.sshj.connection.ConnectionException: Request failed
2020-06-27 13:41:58,069 [13865538] INFO - tesdk.ui.CreateRemoteSdkUIUtil - Request failed
com.jetbrains.plugins.webDeployment.CustomFileSystemException: Request failed
at com.jetbrains.plugins.remotesdk.RemoteSdkUtil.checkInterpreterAndCreateHelpersDir(RemoteSdkUtil.java:360)
at com.jetbrains.plugins.remotesdk.RemoteSdkUtil$1.lambda$run$0(RemoteSdkUtil.java:297)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.intellij.ssh.SshTransportException: Request failed
at com.intellij.ssh.impl.sshj.SshjSshConnection.openChannel(SshjSshConnection.kt:52)
at com.intellij.ssh.impl.SshConnection.openChannel(SshConnection.kt:67)
at com.intellij.ssh.SshConnectionService.sftp(SshConnectionService.kt:171)
at com.intellij.ssh.ConnectionBuilder.openSftpChannel(ssh.kt:141)
at com.jetbrains.plugins.remotesdk.RemoteSdkUtil.checkInterpreterAndCreateHelpersDir(RemoteSdkUtil.java:356)
... 8 more
Caused by: net.schmizz.sshj.connection.ConnectionException: Request failed
at net.schmizz.sshj.connection.channel.AbstractChannel.gotResponse(AbstractChannel.java:405)
at net.schmizz.sshj.connection.channel.AbstractChannel.handle(AbstractChannel.java:192)
at net.schmizz.sshj.connection.ConnectionImpl.handle(ConnectionImpl.java:130)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:500)
at net.schmizz.sshj.transport.Decoder.decodeMte(Decoder.java:159)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:79)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:231)
at net.schmizz.sshj.transport.Reader.run(Reader.java:59)
Maybe that could be more informative.

Laravel 5.7, preset bootstrap error. Failed to open stream

I'm trying to use the laravel 5.7 bootstrap4 preset, but have problems using it.
Do you guys know why I see this error? Why is the file missing? I have not changed the path to anything.
kgp43:~/workspace (master) $ php artisan preset bootstrap
In Bootstrap.php line 41:
copy(/home/ubuntu/workspace/resources/sass/_variables.scss): failed to open stream: No such file or directory
I found the error.
All folders in the Assets directory has to be moved up one level.
It should not be needed to move the content of the Assets folder (accoring to laravel - but it was for me to run the preset command.
https://laravel.com/docs/5.7/upgrade

App Engine PHP - cant find curl.so

Run dev_appserver.py and now get an error relating to curl.so:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\dev\google-cloud-sdk\platform\google_appengine\php\php-5.5-Win32-VC11-x86\curl.so' - The specified module could not be found.
This file does appear to be missing from the directory specified but haven't touched anything and have not had this error before.
How do I resolve?
Additional info
I have found there is already a php.ini file in same directory as app.yaml, just a few basic lines:
extension = "curl.so"
;extension=C:\dev\xampp\php\ext\php_curl.dll
;extension=C:\dev\xampp\php\ext\php_mysqli.dll
So I changed it to comment out the first line and restore the second line:
;extension = "curl.so"
extension=C:\dev\xampp\php\ext\php_curl.dll
;extension=C:\dev\xampp\php\ext\php_mysqli.dll
The error now changes to cant find ...php_curl.dll.
Yet the file seems to be there:
So why the error now? seems the path to dll is correct.
If you want to use Curl and not Curl Lite, then you need to reference the .dll version while using a Windows based system. Create a php.ini file in the same directory as your app.yaml file add the following line to it:
extension = php_curl.dll
If instead you want to use curl lite, you can remove the line above and instead add:
google_app_engine.enable_curl_lite = "1"
to the php.ini file.

Class 'PharData' not found

I get this error on my production server (CentOS 5.4 and php 5.3.5) :
Warning: include_once(PharData.php): failed to open stream: No such
file or directory in /var/www/ZendFramework/library/Zend/Loader.php on
line 146
Warning: include_once(): Failed opening 'PharData.php' for inclusion
(include_path='/var/www/fw:/var/www/vmms:/var/www/ZendFw/library:.:/usr/share/pear:/usr/share/php')
in /var/www/ZendFw/library/Zend/Loader.php on line 146
Fatal error: Class 'PharData' not found in
/var/www/vm/app/Backup.php on line 40
And this is the code which fail :
$phar = new PharData($imageBackupFile);
$phar->buildFromDirectory($imageDir);
Logger::info("Image directory backed up to: $imageBackupFile");
This code is working fine on my own computer.
PharData should be included by default in php 5.3+ ...
Thanks for your help!
UPDATE :
I am using the Zend Auto loader feature to load the good php files using this code :
require_once("Zend/Loader/Autoloader.php");
$autoloader = Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
Zend autoloader is doing the include_once(PharData.php).
Just because Phar is bundled by default in PHP 5.3 doesn't mean that it's necessarily included in your install. When you build PHP with ./configure, you can pass the --disable-phar to disable the Phar extension.
To confirm this, run the following script:
<?php
phpinfo();
?>
One of the first sections to appear will be the Configure Command section. Review this section to see if the --disable-phar switch is present, and if there is a Phar section to the page in general.
If it's not present, you'll need to contact your host to have it enabled. There's a decent chance, however, that they won't do it for you since it could impact other users depending on how their servers are set up. If this is on your own machine, you'll need to either rebuild PHP without that switch, or install Phar manually from PECL (no idea if this would still work in 5.3, but I don't see why it wouldn't).

PHP Extension (memcache|memcached) not showing in phpinfo() but showing in php -m and php -i?

I am getting both modules listed as installed / configured when I use:
php -m
or if I use:
php -i
but when I use:
$m = new Memcache;
// or
$m = new Memcache();
// or
$m = new Memcached();
//or
$m = new Memcached;
I get the following error:
Fatal error: Class 'Memcached' not found
I am running on a Mac - OS X (10.5.7) with default install of apache & php. Additionally, I have memcached running as a daemon on 127.0.0.1:11211 and libmemcache as required by the php-memcached library. I have restarted apache tons of times and even done a machine restart.
Does anyone know why the modules/extensions show up in the command line but not in my phpinfo()? I am literally stumped, after 3 hours of googling, I am just about ready to give up.
Also, please note, my phpinfo() outputs my ini files as follows AND they are both the exact same file:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /private/etc/php.ini
UPDATE:
Apache is failing to load the extension.
[Fri May 14 04:22:26 2010] [warn]
Init: Session Cache is not configured
[hint: SSLSessionCache] PHP Warning:
PHP Startup: Unable to load dynamic
library
'/usr/lib/php/extensions/no-debug-non-zts-20060613/memcached.so'
- (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load
dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so'
- (null) in Unknown on line 0
Does anyone know why or how this would happen? Both of the files referenced above DEFINITELY ARE there. Should I move this question to server fault?
Your webserver is probably using mod_php, which is a seperate bit of code from the standalone (CLI) interpreter. If they are both using the same ini file, and the memcache extension is configured in the ini file, then it sounds like for some reason, the mod_php is failing to load the extension - check your webserver error_log for startup errors.
It may be that the mod_php was compiled without memcache support (most extensions need to have a stub file linked into the php code, even though the bulk of the code is not linked until run time). Or it may be a permissions problem on the shared object file. Or your webserver may be running chroot, and unable to find the extension (which would also mean that although the ini files appear to have the same path, this is relative to different roots).
HTH
C.
because both versions use different php.ini
place your php.ini into location noted in the phpinfo() outout
I would suspect that the issue revolves around permissions. When you run php from comand line, it runs as the user invoking it. When run as an apache module, it runs as "nobody".
I would assume that the memcached.so file, or the directory it's in does not have proper permissions.
I stumpled upon this post and was having the exact same problem with an extension in my php -i but not in phpinfo(). Mine was a permissions problem because of selinux on a CentOS machine. I had to change ownership and permissions and now it is working as expected.
Set php path in environment variables as given below.
Right-click on "My Computer"
Properties
Advanced Tab > Environment Variables
Under System variables, scroll down to find "Path", select and click on Edit.
Add path to your php install on the end (make sure to precede with semi-colon ";"). Example: ";C:\php7"
Click Ok.

Categories