php - Unknown: Failed opening required on line 0. laravel 5.6 - php

I just installed laracast/flash and updated nesbot/carbon via composer. The cmd went nuts while downloading carbon. Cmd interface displayed scattered words and boxes all over the interface for a while and the download was completed.
Did php artisan serve at localhost:8000 and I've got the following errors.
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\NC World\ProjectName\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

This error happens because the server.php file is missing. May be it is deleted or removed from your project directory. I have already faced this problem. Just add the server.php file at root of your project. You can add this file from any other laravel project directory or just create a file named server.php at root directory of your laravel project and paste the following code:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylor#laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
This process works for me.

Try to disable your anti-virus, this happens to me, it seems avast deletes my server.php.
So I added it to the exception

Type in the command line:
php -S localhost:8000 -t public
because port is not public

go to main directory and create new server.php file even you can also copy paste from another created project
same happens to me and i just remove antivirus from my system and just create new file of server

You can also go in your antivurus params and restore server.php + add an exception it worked fine for me without recreate a project.

same problem happen to me:
just delete the project and uninstall the avast antivirus and re create the project

This same thing happens with me just create new laravel project and copy server.php from the new project and paste it to your project

Related

Symfony 3.4 Where to Put Auto-Generating Proxy Class Config Mode?

Symfony is complaining about renaming proxy classes during my multiple instance command execution. Basically, I am running a Symfony command mutliple times at the same time, and it is throwing an error for generated proxy classes not being able to be renamed...
In ProxyGenerator.php line 293:
Warning: rename(/Users/jlroberts/Projects/Shred/Symfony/var/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityNslocaleCountryNames.php.5ee27c106fc5f0.51071995,/Users/jlroberts/Projects/Shred/Symfony/var/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityNslocaleCountryNames.php): No such file or directory
I found this issue on github
https://github.com/doctrine/common/issues/327
And I think it says to set the AutoGeneratedProxyClasses to AUTOGENERATE_FILE_NOT_EXISTS, which I found on
https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/advanced-configuration.html
Which says I use this following line to set that mode
$mode = AUTOGENERATE_FILE_NOT_EXISTS;
$config->setAutoGenerateProxyClasses($mode);
but where do I put that line?

Error in setting laravel project in another PC locally

I am new in laravel. My friend gives me a project to study, but when I set that project on my localhost I receive some error. Can Anyone help me to set that project on my PC.
I Uploaded the server file code[enter image description here][1]
**
Error: Warning: require_once(C:\wamp64\www\hazir/public/index.php): failed to open stream: No such file or directory in C:\wamp64\www\hazir\server.php on line 21 Fatal error: require_once(): Failed opening required 'C:\wamp64\www\hazir/public/index.php' (include_path='.;C:\php\pear') in C:\wamp64\www\hazir\server.php on line 21
**
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylor#laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
It seems that you alter the Laravel app and created a file server.php. and accessing files via URI on the public directory of Laravel. Unfortunately, that's not how Laravel application works.
I assumed you're using a Wampserver, by using this, it may cause you a bit of trouble in setting up Laravel app on your machine. I highly suggest using Laragon or the Laravel created Homestead

You have requested a non-existent service "phpexcel"

I know there are some questions almost identical but none of them seems to be my case.
I have a symfony 2.8.3 project that reads and imports data from an excel file into mysql database. Its all working nice on localhost but in the last 48 hours I've been trying to get it working on my server. Its a shared hosting, with no SSH access to the linux.
When I am trying to load it from the server I get this error: "You have requested a non-existent service "phpexcel"."
Looks like you want to use service from ExcelBundle. But that bundle is not loaded. Check if you have it added for production env.
$bundles = array(
// ...
new Liuggio\ExcelBundle\LiuggioExcelBundle(),
);
Don't forget to clear cache on production environment after any config (AppKernel.php also) change.
To clear cache run php app/console cache:clear. You can also add env parameter: --env=dev or --env=prod - depending on your env. If it don't help then just remove all content of app/cache/ directory (or var/cache/ in case of Symfony3 app)
Pawel answered correctly, but something is missing: after you add this line: new Liuggio\ExcelBundle\LiuggioExcelBundle(), to the AppKernel.php file, inside the $bundles array, don't forget to clear the cache: delete the file from app/cache/dev in case you're in developer mode or app/cache/prod in case on production mode.

Laravel 4.1 to Heroku: SQLSTATE[HY000] [2002] No such file or directory

I deployed my Laravel 4.1 app in Heroku by following this article http://phpartisan.tumblr.com/post/71580870739/running-laravel-4-on-heroku
The static HTML homepage loaded okay but when I am trying to log-in, I am getting the error
SQLSTATE[HY000] [2002] No such file or directory
My local setup is Laravel 4.1 & MySQL.
I don't think there was a database created when I deployed.
Do I need to do it manually? How and what will be my settings then?
thanks!
The problem could be your environment might still point to local. in cli, type heroku run php artisan env to find out.
else, you might wanto run php artisan migrate --env=production to set it to the correct production environment.
you might then encounter another issue like this:
PHP Fatal error: Call to undefined function Symfony\Component\Console\mb_convert_variables() in /var/www/mysite/vendor/symfony/console/Symfony/Component/Console/Application.php on line 1154
Trust me, tt has nothing to do with mb_string module like what this post stated.
Laravel: Call to undefined function Symfony\Component\Console\mb_convert_variables()?
The problem is at environment setting.
First, make sure you have .env.php file at same dir level with composer.json and it is exists in your heroku instance. Since you cant FTP inside, you need to push to repo. But laravel tell you this is git ignored, so you will need to temporary allow it to push to your heroku repo.
Next, you will need to edit the bootstrap\start.php
replace the $env = $app->detectEnvironment(function(){}) to:
$env = $app->detectEnvironment(function() {
return file_exists(dirname(__FILE__) . '/../.env.php')
?
'production'
:
'local';
});
Once you done all these, rerun the migrate command and it will works.
You may follow this link for reference.
Laravel environment config not loading, migration fails - SQLSTATE[HY000] [2002] No such file or directory

'Zend_Session_Exception Error in Zend Framework

I have a website in zend framework which is install in another server. Now I have purchase a new server in ubuntu with Zend Engine 2.3.0 . I have installed Apache server, MYSQL , PHPMYADMIN Tool on this server. Then I upload all the files on previous server to the new server. I have also change the urls in the index.php files.
But it is giving me error.
**Uncaught exception 'Zend_Session_Exception' with message 'Zend_Session::start() - /var/www/sample/library/Zend/Session.php(Line:477):Error #2 session_start(): open(/vlk_session/sess_ielitiholu4219p3nph6lkk8n6, O_RDWR) failed: No such file or directory (2) /var/www/videoliked/library/Zend/Session.php(Line:487): **
This is my below code of index.php file
Zend_Layout::startMvc($options);
Zend_Session::setOptions(array('save_path'=>'/vlk_session'));
if(isset($_COOKIE["Zend_Auth_RememberMe"]) && $_COOKIE["Zend_Auth_RememberMe"] !== false){
Zend_Session::rememberMe("5302000");
setcookie("Zend_Auth_RememberMe", false, time(), "/");
}
if(!Zend_Session::isStarted()){
Zend_Session::start();
}
The save path is absolute.
Did you create the folder /vlk_session on your server?
I'd suggest to use and create
/tmp/vlk_session
Instead, or lookup the PHP default folder for sessions in your php.ini and use the one suggested by vendor.
Update:
Make sure the PHP instance is allowed to read/write that folder.

Categories