Amazon Beanstalk deploy not including submodules - php

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.

Related

i create a new laravel 5.6 website and the server.php file deletes itself

When I create a new Laravel 5.6 website and use php artisan serve in the console the website loads in the browser, but when I refresh the page the server.php file deletes itself and I get a page error.
Below is an image of the error message:
This is the text of the 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\test3\server.php' (include_path='C:\xampp\php\PEAR')
in Unknown on line 0
server.php file is missing so you got this error, Some antivirus considers that the server.php file is a virus, So he simply removes it.
You can also manually create server.php file
Open the link and copy all the code: https://github.com/laravel/laravel/blob/master/server.php
save in Notepad file and set name server.php
Copy the server.php file and paste it inside your Laravel project
Run your project again in browser Now you will not get an error and your Laravel project will work properly.
You need to update both composer and laravel installer. This happens maybe you have latest composer version but outdated laravel installer. To do this, run composer update then composer global require "laravel/installer" to update laravel installer as well.
Lastly check the server requirement for your laravel version. Laravel 5.6 requires at least PHP >= 7.1.3. So make sure you have that in your serve. If not then you probably need to update it.
After the updates, try to install laravel again.
EDIT: I confirmed the issue, it seems a bug in laravel installer
The solution will to create another project then copy the newly created server.php this will solve it.
Also if your anti-virus is avast, you need to add exception there, I have a response in GitHub that avast considers it as a threat.

how to run composer install on the server cpanel

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.

Fatal error when deploy a clean install of Laravel app in 1and1 hosting

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.

Laravel: Error displaying localhost:8000 on browser

When I try to start Laravel artisan on a Command-line using php artisan serve, it works because I get the "Laravel development server started on http://localhost:8000/".
However, when I try to run 'localhost:8000' on my web browser, I get 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\laravel\laravel/server.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0"
In your project folder, the server.php file is missing so you got this error
The solution will to create another project then copy the newly created server.php this will solve it.
Another Solution is:
Open the link: https://github.com/laravel/laravel/blob/master/server.php
Copy all code
Open Notepad and paste your copy code
save Notepad file and set name server.php
Copy the server.php file and paste it inside your Laravel project
Run your project again in browser Now you will not get an error and the Laravel project will work properly.
Try changing your port to 8080. Maybe some other app is already in charge of port 8000 aka port in use.
I also face that problem and after quite a time I become to solve it. it very simple to solve it.
When I copy an old project to new Laravel 5.6 setups. I face this problem.
so you should first install new laravel setup.
copy your previously created project. when you will use php artisan serve. you will see this type of error.
So it's mean in your project folder "server.php" file is missing.
copy this file from other project and paste it your project. it will run.
my problem like this which was I facing solve it by this method.
There are 2 ways to remove this.
FIRST WAY:
(1) copy the server.php from your project folder (
c:\xampp\htdocs\laravel\public\server.php)
NOTE: laravel is name of my project
(2) the file "server.php" which you have copied, paste this file to root folder (c:\xampp\htdocs\laravel)
SECOND WAY:
Trying add this file to root project folder https://github.com/laravel/laravel/blob/master/server.php
I had the same issue, but it was because of bad configuration file paths.php in Boostrap folder (Laravel 4.2).
This Line,
'public' => DIR.'/../public',
It seems the project i cloned had setup the the root of the project to be public, So i removed 'public' and become
'public' => DIR.'/..', and everything worked fine. I hope this will help somebody.
So i can conclude that, on top of missing server.php file as how others have been suggesting, also Public folder path misconfiguration in Bootstrap paths.php or app.php for higher Laravel can result into that error.

Why can't Heroku find my autoload.php file?

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.

Categories