PHPDox File not found - php

I was trying to run phpdox on windows server 2012 - but I am getting the error:
PHP Version: 7.0.5 (WINNT)
PHPDox Version: 0.8.1.1
Exception: TheSeer\phpDox\Generator\TokenFileException (Code: 1)
Location: phar://D:/htdocs/AscPro/bin/phpdox-0.8.1.1.phar/phpdox/generator/pro
ject/TokenFile.php (Line 19)
File 'file:/D:/htdocs/AscPro/build/phpdox/tokens/AppBundle/AppBundle.php.xml'
not found
I've checked the location, the file is not missing.
I'm running into this problem during continuous integration process with jenkins. It is very strange, because the same phpdox version did work for me on ubuntu. Maybe this is related to the fact, that all programs lay on "C:", including Jenkins - but the jenkins workspace lays on "D:"?

I think that the problem lies within incorrect using WINDOWS path. Please see this question:
Help with windows path - PHP
As a quick test, try to change file_exists check to harcoded argument:
file:///C:\htdocs\AscPro\build\phpdox\tokens\AppBundle\AppBundle.php.xml

Im afraid it`s a bug of phpdox.
Phpdox convert all paths to unix style before check to exists.
You can see this code here.
Maybe you can hack function exists
replace:
return file_exists($this->getPathname());
to:
return file_exists(parent::getPathname());

Related

Symfony messenger can't consume messages

Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.

Drupal Module installation error- File Transfer failed, reason: /mysite.com/sites/all/modules is outside of the /mysite.com

I have installed Drupal on Windows 2012 R2 (IIS 8.5) on my DEV and TEST servers. They are clean / out-of-the-box installations. My DEV environment is working fine, but I can’t install modules on my TEST environment. I’ve gone over the installations trying to figure out what is different, but I’ve been beating my head against the wall and they seem identical. Clearly they are not.
Problem
When installing a module, I get this error:
Installation failed! See the log below for more information.
module_filter
•Error installing / updating
•File Transfer failed, reason: /mysite.com/sites/all/modules is outside of the /mysite.com
(Note this is from the Authorize.php)
The permission on my public download folder seems fine – the module uploads and extracts just fine.
My public file system path is set to “sites/default/files” and my temporary directory is set to “sites/default/files/tmp”.
I can't figure out why it thinks the modules folder is outside of my root site!
I’m stumped. Any help would be appreciated!!!
Thanks
Tom Hundley
Solution
As it turns out, this is a bug in Drupal running on IIS. The checkPath method of filetransfer.inc. is case-sensitive, so depending on how you setup the site in IIS, it might work or it might not work! This explained why things work on my DEV environment but not TEST.
Edit the checkPath method in includes/filetransfer/filetransfer.inc and add this code:
$full_path = strtolower($full_path);
$full_jail = strtolower($full_jail);
just before the path comparison:
if ($full_jail !== $full_path) { ... }
FIXED!
References
A HUGE thanks goes out to "sevenares" for posting the solution to this problem here:
https://www.drupal.org/node/1071870#comment-8507091
I hope this helps someone.
Happy coding,
Tom Hundley

App engine update breaks CloudStorage in dev php env

After todays update (release: "1.9.18".) of GoogleAppEngineLauncher, CloudStorageTool now throws an exception it didn't before.
This is the exception thrown:
google\appengine\runtime\RPCFailedError: Remote implementation for app_identity_service.GetAccessToken failed.
The trace looks like this:
google_appengine/php/sdk/google/appengine/api/app_identity/AppIdentityService.php#182
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageClient.php#329
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageUrlStatClient.php#132
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageUrlStatClient.php#63
google_appengine/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageStreamWrapper.php#358
Reproducing code:
$filename = 'test.txt';
$bucket_name = google\appengine\api\cloud_storage\CloudStorageTools::getDefaultGoogleStorageBucketName();
file_exists( 'gs://'.$bucket_name.'/'.$filename );
I'm running the GoogleAppEngineLauncher, PHP runtime. On mac OSX 10.10.2 and testing locally.
Has anybody else experienced this? Does anyone have a workround?
As said in the comment Using GCS in GAE Local devserver there is an issue with 1.9.18. They advise to downgrade to 1.9.17 with this link
Update: As of March 5th, 2105 this was fixed in the public release of 1.9.18, which may be a simpler way to get the fix.

Fatal error: Class 'PHPExcel_Shared_String' not found

I have used PHPExcel for my codeigniter app and it is working perfectly in localhost, but when I host this to server, I am getting following error :
Fatal error: Class 'PHPExcel_Shared_String' not found in \xx\xx\xx
third_party\PHPExcel\Autoloader.php on line 36
There was a change introduced to the autoloader in the latest version of PHPExcel that appears to have broken backward compatibility with versions of PHP < 5.3.0
If you edit the Classes/PHPExcel/Autoloader.php file and change line 58, which should read
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);
to
return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));
I've already made a change to the develop branch on github to test for the PHP version and execute the appropriate line
While this was not deliberate, please note that we really are trying to get users to upgrade to at least version 5.3.0 of PHP, because we can't address any of the memory/performance issues that users working with large spreadsheets complain about until we can use some of the new features available in more recent versions of PHP. Version 5.2 of PHP is no longer supported, and even version 5.3 is end-of-life and will be unsupported before the end of this year
struggled with this issue for a long time under Linux and PHP 5.4x. In the end, in addition to the fix above, I resorted to changing the code on line 73 of the Autoloader file which sets the $pClassFilePath variable from relative (using PHPEXCEL_ROOT) to absolute following the machines file tree. This might only be a hack, but it saved my sanity after several days of trying. Hope this helps someone. Cheers
I had this issue too and i solved it by changing permissions on "Shared" directory to 655.
I Hope it helps
If your server is on Linux, it can be permission problem... Just add all permissions for PHPExcel Folder in you Vendor (on server side) and all subfolders for it. I have same problem and i have solved it by this way...
What worked for me was changing PHPExcel/Autoloader.php line 81 from
if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {
to
if ((stream_resolve_include_path($pClassFilePath) === FALSE)) {
I prefer this approach because it didn't require me to modify file permissions and it should work in PHP 5.3.2 and later.

PHP parser errors in Zend Framework

I just updated my project library folder (with an external to ZF svn) to ZF version 1.11. I'm now getting al kinds of weird errors, related to whitespaces, empty lines, etc. I searched on the internet for quite a while, but can't find a proper answer. I think this is related to some settings in my php.ini file but can't figure it out.
Example of an error:
Parse error: syntax error, unexpected $end in /library/Zend/Application.php on line 415 Call Stack: 0.0042 657160 1. {main}() /mnt/hgfs/htdocs/service/public/index.php:0
PHP version: PHP 5.3.5-0.dotdeb.1
All help would appreciated, I can't wrap my head around it!
I see you're running the project on a hgfs mount, probably inside your VM. Try to run your project off the hgfs mount as I found it to be buggy when dealing with these things.
For one, the default mount options don't keep into account that your file and directory properties (uid and gid) probably aren't the same on your guest and host system. Unfortunately, setting these right didn't fix it for me.
The solution I eventually used was to ditch the hgfs driver and mount the files using sshfs. On Debian you can just install it by running apt-get install sshfs. I then added an entry to /etc/fstab, like this:
sshfs#user#host:/path/to/host/dir /mnt/share fuse comment=sshfs,user,rw,exec,uid=1000,gid=1000,allow_other 0 0
Mounting the share can then be done by running this:
mount /mnt/share
Hope this helps!

Categories