I'm trying to deploy a Symfony2 application in a shared hosting and everyone knows that nobody can run any command on that type of hosting so this is what I do in order to get things done and after reads the docs at Symfony.com site:
All this was done in my development server:
Run the command php composer.phar install --no-dev --optimize-autoloader
Run the command php app/console assetic:dump --env=prod --no-debug
Then after all was done I copied the entire folder to my shared hosting but now I'm getting this error:
Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"/var/www/html/tanane/app/../var/logs/prod.log" could not be opened:
failed to open stream: No such file or directory' in
/home/tanane72/public_html/tanane/var/cache/prod/classes.php:5014
Stack trace: #0
/home/tanane72/public_html/tanane/var/cache/prod/classes.php(4958):
Monolog\Handler\StreamHandler->write(Array) #1
/home/tanane72/public_html/tanane/var/cache/prod/classes.php(4883):
Monolog\Handler\AbstractProcessingHandler->handle(Array) #2
/home/tanane72/public_html/tanane/var/cache/prod/classes.php(5083):
Monolog\Handler\AbstractHandler->handleBatch(Array) #3
/home/tanane72/public_html/tanane/var/cache/prod/classes.php(5388):
Monolog\Handler\FingersCrossedHandler->handle(Array) #4
/home/tanane72/public_html/tanane/var/cache/prod/classes.php(5488):
Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array) #5
/home/tanane72/public_html/tanane/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListene
in /home/tanane72/public_html/tanane/var/cache/prod/classes.php on
line 5014
The file prod.log exists in shared hosting but Symfony is looking in my development server as this line said /var/www/html/tanane/app/../var/logs/prod.log, where I can change that behavior? How the process works in order to change this route to the current one on shared hosting?
You need to copy all files to shared hosting, except app/cache and app/logs dirs. And then in app/config/parameters.yml change database connection to new one.
Then set permissions on app/cache and app/logs dirs to 777
That's all
P.S. And don't forget to check PHP version on hosting, better use 5.4 or 5.5.
Related
The error it gives is
Warning: require_once(header.php): Failed to open stream: No such file
or directory in C:\xampp\htdocs\test4\public\index.php on line 1
Fatal error: Uncaught Error: Failed opening required 'header.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\test4\public\index.php:1 Stack trace: #0
C:\xampp\htdocs\test4\server.php(21): require_once() #1 {main} thrown
in C:\xampp\htdocs\test4\public\index.php on line 1
note there is no index.php file in cPanel but its run but its not run on xampp localhost and throw error
In order to run the laravel files you have to follow a few steps:
Delete the vendor folder which contains the dependencies
Open up a command prompt in the same folder and run composer install to re-install the dependencies
Then open the .env file and update the database credentials
Type this command : php artisan migrate to migrate your database
Finally run php artisan serve to serve the laravel application.
I have a project that I need to edit. To see this project, I wanted to run it on localhost and ran it from wamp. Later, when I entered localhost, I got the error.
On top of that, I wanted to run it from cmd and see it. The response I got at that time was as follows.
Fatal error: Uncaught Error: Failed opening required 'C:\wamp64\www/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp64\www\artisan:18
Stack trace:
#0 {main}
thrown in C:\wamp64\www\artisan on line 18
check if there is any /vendor/autoload.php file in your wamp folder if not try composer install in the terminal where your project is located. (if you don't have composer install the composer first via this url)
you can start your project directly with php artisan serve too. if php is added to your windows path variables.
Due to unable to access Terminal in hosting server, I ran composer update in my local machine and uploaded everything including vendor folder, composer.json and composer.lock. My hosting server run PHP 7.1 and so does my local machine with Laravel 5.5.
Now I am facing PHP Fatal error: Uncaught ReflectionException: Class view does not exist in /public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php:752
Stack trace:
#0 /public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(752): ReflectionClass->__construct('view')
#1 /public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('view')
#2 /public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\Container\Container->resolve('view', Array)
#3 /public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(732): Illuminate\Container\Container->make('view', Array)
#4 /public_html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(110): Illuminate\Foundation\Application->make('view', Array)
#5 /public_html/vendor/laravel/framework/src/Illuminate/Found in /public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
I ran the following command.
composer require maatwebsite/excel --no-update
composer update maatwebsite/excel
And I uploaded the following files and folder from local to live server.
Vendor / maatwebsite folder and all other newly created by folders.
vendor / composer folder
composer.json
composer.lock
I cleared config cache, route cache, view cache from PHP file using artisan command.
Can anyone please help me to debug the error?
Thank you.
You're missing bootstrap/cache/packages.php and bootstrap/cache/services.php
These files are updated when you run composer require or update as part of the package discovery.
I've been googling this for half an hour and nothing's working. I've got PHP added to my windows path variable, and everytime I run this:
php composer.phar install --no-dev --optimize-autoloader
I get this
Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "composer.phar"' in composer.phar:23
Stack trace:
#0 composer.phar(23): Phar::mapPhar('composer.phar')
#1 {main}
thrown in composer.phar on line 23
I'm CD'd into the folder it's in, I've tried specifying that folder in the command, nothing's working, neither does
php -r "readfile('https://getcomposer.org/installer');" | php
edit: Ok I signed out and back in after trying the windows exe installer, seems it's installed now but only globally, I still don't have the vendor/bin directory I need in my specific project, still fails when I try and run php composer.phar install
I am trying to int Zend framework 2. I aready have xampp running. I followed the steps on this answer. How ever when I visit the url I specified I get the following descriptive error:
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable.' in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php:51 Stack trace: #0 C:\xampp\htdocs\ZendSkeletonApplication\public\index.php(18): require() #1 {main} thrown in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php on line 51
as the exception states. I went on to run the command php composer.phar install
and nothing happens. nothing displays on th cli to showing anything being installed. and when i run again application i get the same error. Where else can I look and check for errors. Thanks
I am using PHP Version 5.6.8
So what worked for me. I began again from scratch following the tutorial here
Then I still got a "could not open input file: composer.phar" when I ran the command: php composer.phar install
so according to "www.softanalyst.com/zend-2-framework-installation-with-xampp/#comment-883" I need to run the following command:
php -r "readfile('https://getcomposer.org/installer');" | php
which I did and it all worked.
open up your terminal and move To your project using the cd project directory
one type dir composer.phpr and try this one dir composer.json if both file listed than do the next step otherwise download the composer in current directory and run the following command as bellow.
php composer.phar install this comman will install all required dependency from the composer.json file. it will take time as depend on internet speed.
once it's complete than try this link for further steps.this link also having how To install composer And skeleton application.
Github
Twitter