I have successfully uploaded my symfony app to the server. I have also copied the content of the web folder into the public_html folder of my website. But when I access my app via the www.domain.com I get this error
Warning: require_once(/home/domain/public_html/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /home/domain/public_html/app.php on line 6
Fatal error: require_once(): Failed opening required '/home/domain/public_html/../app/bootstrap.php.cache' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/app.php on line 6
After researching I found that you can run composer install on the server but my challenge is that I dont know how to run cli command on the server via ssh/cpanel.
Please who will be kind enough to show me the way. This is my first attempt on trying to host a symfony application
When you don't run an composer install your dependencies are missing and the bootstrap.cache.php isn't created. So you have to upload the file and the complete vendor folder.
But i would prefer to take a look at your SSH connection and use the correct way. Otherwise you have to upload every time your complete sources including your vendor folder which can take a lot of time.
And the next think is your path. The components from your Symfony application are normally outside of your webroot. So you have to be sure that you can access that folders outside your webroot.
In some systems you have to allow that before you can use it. Otherwise you have to upload your complete application to your public_html folder and put your domain to the web subdirectory.
Related
I created laravel 7 project in my /home/namiq/projects/airblog folder.
After I finished my works I copied project files to /var/www/airblog folder in my pc. When I try to open web site it says
The stream or file "/home/namiq/projects/airblog/storage/logs/laravel-2020-07-18.log" could not be opened: failed to open stream: Permission denied
So what is the problem?
Why it points to old path?
How to change storage folder to point to new path?
Interesting. I usually deploy using git, that's why I always have to do a
composer install
once my files are on the server. Maybe that will help in your case, too?
Maybe also try a
composer dump
To generate new autoload files first.
I'm trying to upload a Laravel application to a 1and1 hosting, but I'm facing some problems. This is what I get when I try to access to my app:
Fatal error: require(): Failed opening required '/homepages/39/d425938714/htdocs/webs/myapplication/vendor/composer/ClassLoader.php' (include_path='.:/usr/lib/php5.6') in /homepages/39/d425938714/htdocs/webs/myapplication/vendor/composer/autoload_real.php on line 12
It's a clean install of Laravel.
Thanks in advance.
Answering the comments:
#feela, yes, that path exists in the server.
#aynber, yes, I did composer install in my local machine, then I zipped the entire folder, uploaded to the server and unzipped the file.
It seems that when I unzip the the file, the names of the classes change to lower case, I don't know why, and that's why the application couldn't find any class. It was looking for ClassLoader.php when the class was renamed to classLoader.php.
I'm setting up a demo site for a Wordpress plugin on Heroku. My plugin uses composer to manage dependencies, and it's configured as a git submodule on my local installation. I push to heroku and everything seems to work. I use heroku run bash to ssh into the app and manually run composer install from inside my plugin. Then I log into the site and try to activate my plugin... but I get the following error:
Plugin could not be activated because it triggered a fatal error.
Warning: require_once(/app/wp-content/plugins/wp-github-pipeline/vendor/autoload.php): failed to open stream: No such file or directory in /app/wp-content/plugins/wp-github-pipeline/wp-github-pipeline.php on line 23 Fatal error: require_once(): Failed opening required '/app/wp-content/plugins/wp-github-pipeline/vendor/autoload.php' (include_path='.:/app/.heroku/php/lib/php') in /app/wp-content/plugins/wp-github-pipeline/wp-github-pipeline.php on line 23
I don't get it. With heroku run bash I can see that the file is actually there. And I don't get this issue locally or on another remote server. Why is it happening here?
I can't say for sure why this worked but it appears that Heroku doesn't really play nicely with composer.json somewhere other than the project root. So I took my project's composer.json and moved it to the project root, then I added...
"config": {
"vendor-dir": "wp-content/plugins/wp-github-pipeline/vendor"
}
...which caused the dependancies I needed (and the autoload.php) to get installed in the original location.
With this, I am able to push to Heroku normally without issues.
I have NO idea why I was able to run composer install manually without it working. I also have NO idea why heroku run bash would show me files that aren't actually there.
According to me you have to regenerate the autoload. Hope that you have written code within composer.json for autoloads.
composer dump-autoload
This will regenerate your autoload and it will solve your problem. If not please modify your question by pasting your composer.json.
What I did to solve this was add an include_path to my .user.ini file. That ini file needs to be located in the document root, not the app's root.
include_path = ".:/app/.heroku/php/lib/php:/app/vendor/"
Don't copy my include_path example verbatim, as it might now be the needed include path for your app. Get your current include path from Heroku's error log, and then append :/app/vendor to it.
What's important there is adding /app/vendor/ to the include_path. That will point yourrequire php statement to the spot where Heroku puts the autoload.php.
I currently use Xampp on Windows for a local web development. In my web root, I have symlinks to each of my projects like so:
http://i.stack.imgur.com/GW9Yt.png
When the symlink is followed via explorer, it opens up the correct folder and location however, when loaded via Apache in my browser (localhost/project) I receive this error:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:/xampp/htdocs/project/index.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0
The file index.php is located inside the directory the symlink is directed at.
I believe this is a permission error however I cannot seem to discover what might be causing this as I have individually checked the permissions of each folder, file, etc and can't seem to find the issue.
Something I have noticed is that files located in folders located inside folders inside the symlink, e.g. link/style/file.txt will load however those in the root directory of the symlink do not.
Even I faced the same problem while installing magento on XAMPP & Windows-7. This clearly solved my problem.
Stop the apache and mysql
Exit XAMPP
Click on start button and search for XAMPP
Right click on "XAMPP Control Panel" and "Run as administrator"
Now you start apache and mysql
Your symlinks should start working now
I am using this wordpress skeleton locally and have an issue getting it to work on AWS Beanstalk. When I open /index.php I am seeing a blank page in the browser and the following message in the logs:
PHP Fatal error: require(): Failed opening required './wp/wp-blog-header.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/app/current/index.php on line 4
The location ./wp/wp-blog-header.php relative to file index.php exists, but php on beanstalk is unable to find it. When I change it to wp/wp-blog-header.php its not working either.
Update
It turns out the command eb deploy is not pushing submodules and my setup is using a submodule. So the files are actually not there because they are in a submodule. Is there a way to make this happen? I am using awsebcli 3.1.2.
You could use .ebextensions config to run any commands. Also for modules install/deploy.