skip to Main Content

I have a php project that was running on xampp but i created an ec2 instance with linux and i access it with his private ip on putty because the web app is supposed to be accessible just via intranet. i used stp to move the whole project, everything works the same but the composer on some php files give me that error( i got it from apache log)

PHP Fatal error:  Uncaught Error: Failed opening required '/var/www/html/host/public_html/vendor/composer/../ezyang/htmlpurifier/library/HTMLPurifier.composer.php' (include_path='.:/usr/share/php') in /var/www/html/host/public_html/vendor/composer/autoload_real.php:41nStack trace:n#0 /var/www/html/host/public_html/vendor/composer/autoload_real.php(45): {closure}()n#1 /var/www/html/host/public_html/vendor/autoload.php(25): ComposerAutoloaderInitc3b80a39a0d2307602d3e5706c8f19a8::getLoader()n#2 /var/www/html/host/public_html/accessdata.php(18): require('...')n#3 {main}n  thrown in /var/www/html/host/public_html/vendor/composer/autoload_real.php on line 41, referer: http://host/page1.php

i use composer to use the phpoffice, the user should be able to upload some excel files then using php i upload them on a database

EDIT: when running composer install
i get this error
Failed to download myclabs/php-enum from dist: curl error 28 while downloading https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483: Connection timeout after 10001 ms

2

Answers


  1. @mega. As you mentioned you have uploaded the composer.phar file on server, try creating autoload.php file again by running composer dump-autoload command from root folder of your application and check if its working.

    composer dump-autoload command regenerate the autoload file again and for that you do not need to have internet connection.

    If you run into error like "Failed to open stream: Permission denied" try run this command with sudo.

    Login or Signup to reply.
  2. You have a serious misunderstanding that should be put out of the way right from the beginning:

    • If your box has no internet access, you will have little joy with running Composer commands that actually need the internet to fulfill the task you are calling them for.
      • For example the "composer update" command you want to run without internet access.
    • Composer does no wonders and creates internet access out of no internet access.
    • If you not yet see, why this is actually of little surprise, then it must be the serious misunderstanding you have both on Composer and the fundamental difference between Wide Area Network (WAN) and Local Area Network (LAN).
    • The best place is localhost btw. Your home is your castle.

    So you have certainly a relationship problem in your Composer marriage.

    Composer therapist Nico Haase already commented, "You don’t need to install Composer on any production system" and if you’re looking for a second opinion, I second that. I actually would say, if you’re installing Composer on a production system you’re asking for trouble, problems, broken hearts (and dependencies).

    You write it your own:

    i [sic!] uploaded from local copy, i dont [sic!] have internet access on the server

    So, build the vendor folder locally with Composer, then upload the whole application code (including the vendor directory). Done.

    Yes, done.

    Machine working again.

    And they lived long and happily.

    (It may require reading, as every couples therapy is with the work of each individual to find back together. This can be a daunting time, always remind the bright outlook and all the future you two will have together, exploring the wild corners of the intranets together.)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search