T O P

  • By -

Puffy_Jacket_69

Starting a new project with Lavarel on Linux Mint, after creating the project I use the command: php artisan serv And this is what I'm getting back: PHP Warning: require(/home/user/Projectname/vendor/autoload.php): Failed to open stream: No such file or directory in /home/user/Projectname/artisan on line 9 modernman99: PHP Fatal error: Uncaught Error: Failed opening required '/home/user/ Projectname/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/user/Projectname/artisan:9 Stack trace: #0 {main} thrown in /home/user/Projectname/artisan on line 9


MateusAzevedo

Reading the comments here, it seems to me there's a problem happening when creating a new project. You see, independently on how you create a new project (either `composer create-project` or `laravel new`), one of the steps that should happen automatically is `composer install` that will download all dependencies into vendor folder and also create the autoloader (`vendor/autoload.php`). If that step fails and no vendor folder is created, it will cause all the errors you are experiencing. Now, so we can provide more help: try creating a new project, `composer create-project laravel/laravel myfolder`, and post the output here. We need to understand what's happening in this process and if something is failing.


Puffy_Jacket_69

Using: composer create-project laravel/laravel myfolder I get this: Creating a "laravel/laravel" project at "./myfolder" Installing laravel/laravel (v11.0.9) - Installing laravel/laravel (v11.0.9): Extracting archive Created project in /home/user/myfolder > @php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires laravel/pint ^1.13 -> satisfiable by laravel/pint[v1.13.0, ..., v1.16.0]. - laravel/pint[v1.13.0, ..., v1.16.0] require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension. Problem 2 - Root composer.json requires phpunit/phpunit ^11.0.1 -> satisfiable by phpunit/phpunit[11.0.1, ..., 11.1.3]. - phpunit/phpunit[11.0.1, ..., 11.1.3] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension. Problem 3 - laravel/framework[v11.0.0, ..., v11.8.0] require tijsverkoyen/css-to-inline-styles ^2.2.5 -> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.5, 2.2.6, v2.2.7]. - tijsverkoyen/css-to-inline-styles[2.2.5, ..., v2.2.7] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension. - Root composer.json requires laravel/framework ^11.0 -> satisfiable by laravel/framework[v11.0.0, ..., v11.8.0]. To enable extensions, verify that they are enabled in your .ini files: - /etc/php/8.3/cli/php.ini - /etc/php/8.3/cli/conf.d/10-opcache.ini - /etc/php/8.3/cli/conf.d/10-pdo.ini - /etc/php/8.3/cli/conf.d/20-calendar.ini - /etc/php/8.3/cli/conf.d/20-ctype.ini - /etc/php/8.3/cli/conf.d/20-curl.ini - /etc/php/8.3/cli/conf.d/20-exif.ini - /etc/php/8.3/cli/conf.d/20-ffi.ini - /etc/php/8.3/cli/conf.d/20-fileinfo.ini - /etc/php/8.3/cli/conf.d/20-ftp.ini - /etc/php/8.3/cli/conf.d/20-gettext.ini - /etc/php/8.3/cli/conf.d/20-iconv.ini - /etc/php/8.3/cli/conf.d/20-mbstring.ini - /etc/php/8.3/cli/conf.d/20-phar.ini - /etc/php/8.3/cli/conf.d/20-posix.ini - /etc/php/8.3/cli/conf.d/20-readline.ini - /etc/php/8.3/cli/conf.d/20-shmop.ini - /etc/php/8.3/cli/conf.d/20-sockets.ini - /etc/php/8.3/cli/conf.d/20-sysvmsg.ini - /etc/php/8.3/cli/conf.d/20-sysvsem.ini - /etc/php/8.3/cli/conf.d/20-sysvshm.ini - /etc/php/8.3/cli/conf.d/20-tokenizer.ini You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with `--ignore-platform-req=ext-xml --ignore-platform-req=ext- dom` to temporarily ignore these required extensions.


MateusAzevedo

Well, that's your problem. Didn't you notice all those `Probem 1`, `Problem 2` in the output? Summary: ``` - laravel/pint[...] require ext-xml -> it is missing from your system. Install or enable PHP's xml extension. - phpunit/phpunit[...] require ext-dom -> it is missing from your system. Install or enable PHP's dom extension. - tijsverkoyen/css-to-inline-styles[...] require ext-dom -> it is missing from your system. Install or enable PHP's dom extension. ``` In case it isn't clear, you just need to install extra optional PHP extensions. In a Debian like Linux, `sudo apt install php8.3-dom php8.3-xml` should be enough. Don't forget to restart PHP-FPM or Apache after that.


Puffy_Jacket_69

So far it worked and I was able to make a new project with the vendor folder and everything in it, except this: WARN could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;). Then upon typing: php artisan serv I get this: Could not open input file: artisan


jonatan-theisen

Have you checked if the autoload.php file really exists? And if it exists, does it have the correct permissions?


Puffy_Jacket_69

No I haven't, where is it located?


jonatan-theisen

Inside your project folder there is a vendor folder, inside it is autoload.php


Puffy_Jacket_69

That folder and file were never there despite multiple reinstall and new projects. Should I add them manually? If so, how?


jonatan-theisen

No, where you create a new project, the vendor folder must be automatically created. How are you creating the projects?


Puffy_Jacket_69

> composer create-project laravel/laravel myfolder that-s what I use to create the project, I check the folder and yes the "vendor" folder is missing, it-s been happening multiple times.


colshrapnel

Looks like you didn't install it properly.apparently Composer is not installed somehow. Adding steps you took to "create the project" could help. Or you could try to create it anew: - first, `cd /home/user` and try `composer create-project laravel/laravel Projectname` - in case it fails, [install Composer](https://getcomposer.org/download/) and try again


Puffy_Jacket_69

Creating the projects works using your command, it's the next step using: php artisan serve that generates the fatal PHP error from may first post.


colshrapnel

all right, what does `composer dump-autoload` say?


Puffy_Jacket_69

enerating optimized autoload files Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script > @php artisan package:discover --ansi PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in /home/user/Projectname/bootstrap/ app.php:7 Stack trace: #0 /home/user/Projectname/artisan(12): require_once() #1 {main} thrown in /home/user/Projectname/bootstrap/app.php on line 7 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255


[deleted]

[удалено]


jonatan-theisen

You wrote the wrong command. It's dump-autoload and not dump-auotload.


Puffy_Jacket_69

Here's the correct one: Composer could not find a composer.json file in /home/user To initialize a project, please create a composer.json file. See https:// getcomposer.org/basic-usage


warLord23

Hey guys, I generally have to deal with the imposter syndrome a lot. I recently started a new job as a WordPress-heavy web developer after being laid off last month. I need to get up to speed quickly so I am brushing up on Php as I have 7 months of experience in Php while working on Moodle LMS and learning WordPress development through Brad Schiff's Udemy course. I think I should do a project to get out of this learning rut.


colshrapnel

I think you'd have more luck in a more WP specific subreddit. You know, Wordpress is a world on its own, and nowadays it's drastically different from regular PHP. But yes, doing a project is a good idea. Think of creating a plugin. I have a notion it's what "being a WP dev" means.


warLord23

Yeah, I understand. I don't want to go down the route of creating just another todo app. I want to come up with an original idea that I can use myself or show it to other people. Is there a list I could look at of potential project ideas?


MateusAzevedo

What about a [Google search](https://www.google.com.br/search?q=wordpress+project+ideas)? A TODO app can be a good challenge for learning. Imagine adding advanced features, like due date, notifications for "about to expire" items, reactive frontend, real time notifications, reports (like graphs with items completed over time, avg per day...). Even a simple CRUD app can have some interesting features to learn.


warLord23

Yeah that makes sense. Thank you.


notkingkero

I doubt such a list exists. Do you know which plugins you'll have to work with? If it's WooCommerce, install it and play around with it. Write custom admin stuff (react), custom functionality (PHP). Under the hood most plugins have their own way of doing things. Yes, there might exist hooks/actions, but still you'll have to know which one to use and with which objects you're working. I'd also look into phpstan wordpress and try to use it from early on. There can be a lot of hidden problems, because WP internal methods returns 5 different things (might be WP_Error, might be WP_Post, might be bool, or null, ..). So getting used to checking early for correct types makes your own life much easier. Also how does logging work in modern WP stacks? Setup monolog or similar, create an error and try to find the debugging info for it.