Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

knached99's avatar

Unable to deploy laravel app to IONOS shared hosting

I need help deploying a laravel application to IONOS shares hosting. I have a laravel application scaffolded with breeze for authentication. I tried to deploy to IONOS but kept getting a 403 error. Unfortunately there e were no logs so I can troubleshoot. I modified my .HTACCESS file so it can work for IONOS:

‘’’ <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule>

RewriteEngine On
RewriteBase /    RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]

</IfModule> ‘’’ It still did not work. Can someone please help? I need to deploy this site for my client asap!

0 likes
65 replies
hupp's avatar

@knached99

sudo chown -R $USER:$USER storage 
sudo chown -R $USER:$USER bootstrap/cache
sudo chmod -R 775 storage
sudo chmod -R 775 bootstrap/cache

Kindly run above command in the server or if you not able to run it give manually permission to storage and public folder. It will prevent to generate error log due to log permission and also make APP_ENV=local APP_DEBUG=true until deploy successfully.

1 like
vincent15000's avatar

I have a lot of Laravel website on my Ionos shared webhosting.

You have nothing to do, all works fine out of the box from your local environment.

I just had to correct something in the .htaccess fine, but I don't remember what, I now always use this one.

<IfModule mod_rewrite.c>

    RewriteBase /

    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    
</IfModule>

Have you thought about generating the app key with php artisan key:generate ?

Have you installed the vendor files with composer install ?

You also need to point the domain to the public folder and not to the root folder of the application.

2 likes
knached99's avatar

@vincent15000 Yup, I've ran composer install and both the composer.json and composer.lock files are there. I'm getting a 403 error though so it could be related to the storage. And @hupp how can I manually give permission to the storage and public folder? I do not have root access to IONOS shared hosting. I've already generated the app key prior to moving files to the remote ionos server. I'm curious as to whether or not it is also with how I'm pointing to the public folder. in the IONOS remote server, In .htaccess, I'm pointing to index.php but the folder is a subfolder. This is my .htaccess: ```<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]

</IfModule>```

1 like
knached99's avatar

@hupp I looked at the file permissions and have confirmed that the storage folder has read, write, and access permissions: 777 so not sure what else it could be.

1 like
knached99's avatar

@vincent15000 How do I point my domain to the public folder? and @hupp I have made the APP_ENV=local and APP_DEBUG=true but I did not see any errors. still the 403 forbidden page. The files are already on the IONOS shard hosting server. My question is, could all these errors be happening because I'm creating the site in a sub-domain? As I've said before, the structure is in: WebsiteName/ the rest of the files

1 like
vincent15000's avatar

@knached99 You don't have to modify the permissions, all is configured by IONOS.

I have read that you handle storage ? Do you have executed php artisan storage:link ?

Furthermore to point your domain to the public folder, you need to log in to your IONOS account, go to the domains list and you have a link to use the domain : by clicking on this link you will have the different choices on how to use the domain : point to a folder, point to an external IP address, ...

knached99's avatar

@vincent15000 I could not execute any php artisan commands, I keep getting this error:

(redacted)WEBSITE_NAME $ php artisan storage:link
Content-type: text/html

<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/homepages/43/redacted/htdocs/WEBSITE_NAME/artisan</b> on line <b>33</b><br />
<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING in <b>/homepages/43/redacted/htdocs/WEBSITE_NAME/artisan</b> on line <b>33</b><br />

On IONOS the php version is 8.2 which is fine. However when I ssh'd into their server and ran php -v, I got this:

(uiserver):REDACTED:~/WEBSITE_NAME $ php -v
PHP 4.4.9 (cgi-fcgi) (built: Mar 28 2023 09:06:52)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
acobrerosf's avatar

So first of all, are you using a different public folder? Most of my projects have a public_html folder instead of just public for example. If so it would be a good idea to tell laravel that in the AppServiceProvider

With regards to .htaccess, as mentioned above I always add the following rule below "RewriteEngine On":

RewriteBase /

And lastly, please don't change the permissions of any of your folders to 777 as it could be a potential security risk. It should be 755 if I recall correctly.

1 like
vincent15000's avatar

@acobrerosf @knached99 In which folder have you copied the project ?

I create a specific folder for each of my project in my personal folder (the one I am when I connect with SSH).

knached99's avatar

@acobrerosf Thank you, I'll def change it to 755 because the default from when I checked was 777.

knached99's avatar

@vincent15000 I did not copy the project into any specific folder from the default folders on IONOS shared hosting server. I basically took the github project folder from my local computer and copied all of them into the IONOS server.

1 like
knached99's avatar

@acobrerosf I'm not using a different public folder. It's the public folder that comes with laravel.. located within: website_name/public Do I have to rename it to public_html ? and what code do I have to put in the AppServiceProvider? And by the way, I could not run composer install at all within my project on the ionos server. It said command not found, despite the .composer folder being located within the project root directory.

vincent15000's avatar

@knached99 That's not the right way to do that.

I do this way :

  • connect to IONOS with SSH

  • retrieve the github project git clone ...

  • cd myproject

  • install composer https://getcomposer.org/download/ to install composer you need to use the php command with its full path /usr/bin/php8.1-cli and with the right version you need

  • /usr/bin/php8.1-cli composer.phar install

  • /usr/bin/php8.1-cli artisan key:generate

  • /usr/bin/php8.1-cli artisan storage:link

knached99's avatar

@vincent15000 Let me try, I thought I had to get the IONOS Deploy now because my client has the IONOS shared hosting so I didn't know you get github access with it.

1 like
acobrerosf's avatar

@knached99 No you don't have to do it, however some cheap servers usually force you to use a specific folder name, but if that is not the case it's ok.

Unfortunately I don't have experience with IONOS shared hosting specifically so can't tell what the issue could. However things to check usually when deploying is:

  • .htaccess file
  • Apache/Nginx config
  • PHP version and extensions
  • Server cache if any

If the php version running on ssh is not the same as the one configured in the panel you would probably need to find where the php8.1 file is located. If you run the command:

$ where php

It should tell where the current php4 version is located and hopefully the 8.1 version is somewhere around that folder.

1 like
vincent15000's avatar

@knached99 Don't forget to set the right PHP version for the domain / subdomain for your application. It's customizable from the IONOS configuration panel.

knached99's avatar

@vincent15000 I was able to successfully clone into the repo but when attempting to download composer from the link you gave me I got this error:

(uiserver):REDACTED:~/WEBSITE_NAME$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>] 
       php <file> [args...]
  -a               Run interactively
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.
(uiserver):REDACTED:~/website_name$ php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>] 
       php <file> [args...]
  -a               Run interactively
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.
(uiserver):REDACTED:~/website_name$ php composer-setup.php
Status: 404
Content-type: text/html

No input file specified.
1 like
vincent15000's avatar

@knached99 Sure ... you need to replace the php command by its full path /usr/bin/php8.1-cli (replace here the version by the version you need) and then it will work.

vincent15000's avatar

@knached99 Same remark when you will execute /usr/bin/php8.1-cli composer.phar install (don't forget .phar).

Same remark when you will execute /usr/bin/php8.1-cli artisan ....

knached99's avatar

@vincent15000 Thank you, seems like the installation worked, however I could not run composer install nor can I run any of the artisan commands:

Installer verified
(uiserver):RREDACTED~/website_name$ /usr/bin/php8.1-cli  composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 2.5.8) successfully installed to: /homepages/43/REDACTED/htdocs/website_name/composer.phar
Use it: php composer.phar

(uiserver)::REDACTED~/website_name$ /usr/bin/php8.1-cli  -r "unlink('composer-setup.php');"
(uiserver)::REDACTED~/website_name$ composer install
-bash: composer: command not found
(uiserver)::REDACTED~/website_name$ /usr/bin/php8.1-cli artisan
(uiserver)::REDACTED~/website_name$ /usr/bin/php8.1-cli artisan storage:link
(uiserver)::REDACTED~/website_name$ /usr/bin/php8.1-cli composer install
Could not open input file: composer
(uiserver)::REDACTED~/website_name$ 

1 like
vincent15000's avatar
Level 63

Have you read my previous comment ?

/usr/bin/php8.1-cli composer.phar install

Don't forget .phar.

1 like
vincent15000's avatar

@knached99 Then you will need to set values to all the needed keys in the .env file. For example the database credentials which you have to retrieve from your IONOS account.

To do that you IONOS offers you only one possibility to edit files : vi.

knached99's avatar

@vincent15000 Tysm I was able to successfully run composer install and usr/bin/php8.1-cli artisan storage:link !! However my website is still returning the 403 error and I'm not sure why!

1 like
knached99's avatar

@vincent15000 I've confirmed that the env file has the app key but when I tried to migrate I got this error:

/usr/bin/php8.1-cli artisan migrate

                                                                                                                                           
                                                        APPLICATION IN PRODUCTION.                                                         
                                                                                                                                           

  Do you really wish to run this command? (yes/no) [no]
❯ yes


   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select * from information_schema.tables where table_schema = Hifz and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:795
    791▕         // If an exception occurs when attempting to run a query, we'll format the error
    792▕         // message to include the bindings with SQL, which will make this exception a
    793▕         // lot more helpful to the developer instead of just the database's errors.
    794▕         catch (Exception $e) {
  ➜ 795▕             throw new QueryException(
    796▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    797▕             );
    798▕         }
    799▕     }

      +38 vendor frames 

  39  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

When I ran the same command but with fresh tacked on I got this error:

/usr/bin/php8.1-cli artisan migrate:fresh

                                                                                                                                           
                                                        APPLICATION IN PRODUCTION.                                                         
                                                                                                                                           

  Do you really wish to run this command? (yes/no) [no]
❯ yes


  Dropping all tables .......................................................................................................... 5ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:795
    791▕         // If an exception occurs when attempting to run a query, we'll format the error
    792▕         // message to include the bindings with SQL, which will make this exception a
    793▕         // lot more helpful to the developer instead of just the database's errors.
    794▕         catch (Exception $e) {
  ➜ 795▕             throw new QueryException(
    796▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    797▕             );
    798▕         }
    799▕     }

      +46 vendor frames 

  47  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()



1 like
knached99's avatar

@vincent15000 Of course. I have it right here:

All information has been redacted:

DB_CONNECTION=mysql
DB_HOST=DB_CONNECTION_HOST
DB_PORT=DB_PORT
DB_DATABASE=DB_NAME
DB_USERNAME=DB_USER
DB_PASSWORD=DB_PWD

1 like
vincent15000's avatar

@knached99 No ... you have to put your own values.

Log in to your IONOS account, create a database and retrieve its credentials. Then write these credentials in the .env file.

DB_HOST should look like db...hosting-data.io
DB_PORT should be customize with the right port (3306 ?)
DB_DATABASE should start with dbs...
DB_USER should start with dbu...
DB_PASSWORD with your own password for the created database

I'm curious : where are you from ?

knached99's avatar

@vincent15000 Yes it is like that but I redacted that info from here.. This is what it looks like with sensitive data redacted:

DB_CONNECTION=mysql
DB_HOST=xxx.hosting-data.io
DB_PORT=3306
DB_DATABASE=dbsxxxx
DB_USERNAME=dbuxxxx
DB_PASSWORD=xxxxxxx

1 like
knached99's avatar

@vincent15000 Yes that's the thing, I could not run the migration and this is what my DB configuration in the .env file looks like

1 like
vincent15000's avatar

@knached99 Check once more if you don't have any error in the values in the .env file. For some passwords, I need to write them between double quotes.

knached99's avatar

@vincent15000 I double checked. There was a whitespace in my app name which prevented it from executing and also the DB PWD was wrong so I changed it. The migrations and seeding ran but there is still a 403 error on my site. Where do I check to see if the site is pointing to the public folder or not? That is the only thing that could be causing this to not work.

1 like
vincent15000's avatar

@knached99 You need to go to your IONOS account and list the domains / subdomains. Foreach domain / subdomain, you have a link to define how to use it.

knached99's avatar

@vincent15000 I did check and the target is: /website_name so not sure how it knows where the public folder is?

1 like
vincent15000's avatar

@knached99 is the folder where you have cloned the application named website_name ? If it is the case, you need to point the domain to website_name/public.

knached99's avatar

@vincent15000 Yup I did that and getting sooo close!! I got this error now:

Illuminate
 \ 
Foundation
 \ 
ViteManifestNotFoundException
PHP 8.2.8
10.15.0
Vite manifest not found at: /homepages/43/d970947193/htdocs/WEBSITE_NAME/public/build/manifest.json

How can I install npm so that I can run npm run build in order to compile vite assets?

I'm using Laravel Breeze for the authentication scaffold which is why it needs to use vite

1 like
vincent15000's avatar

@knached99 In the local development environment, run npm run build, then add the build folder to git and push the code. Then on the production server, pull the code.

vincent15000's avatar

@knached99 No. You need to upload the build folder to github.

You can simply type git add build/* in the console.

knached99's avatar

I tried and got an error:

 git add build/*
zsh: no matches found: build/*

1 like
vincent15000's avatar

@knached99 Sorry it's public/build. Have a look at the public folder, you will see a new folder inside it : build with all needed files for production.

vincent15000's avatar

@knached99 Then you will perhaps have a last thing to do : update the .htaccess with the content I posted in my first comment at the beginning of this post. Effectively the default one suggested by Laravel doesn't work for me, I had to customize it and since I always use the same.

knached99's avatar

@vincent15000 I tried adding build to git from there but it did not work as you can see here:

assets		build		favicon.ico	index.php	robots.txt	storage
(base) khalednached@Khaleds-MacBook-Pro public % cd ..
(base) khalednached@Khaleds-MacBook-Pro KhizrWebsite % cd public/build
(base) khalednached@Khaleds-MacBook-Pro build % ls
assets		manifest.json
(base) khalednached@Khaleds-MacBook-Pro build % git add build/*
zsh: no matches found: build/*
(base) khalednached@Khaleds-MacBook-Pro build % git add build
fatal: pathspec 'build' did not match any files
(base) khalednached@Khaleds-MacBook-Pro build % ```
1 like
knached99's avatar

Tysm it works!! I am able to see the website now!! However there are 500 errors in other areas so I'm going to troubleshoot those but the main issue is resolved. Can't thank you guys enough!

2 likes
waqassth's avatar

@vincent15000 I am using IONOS managed server and Deployed a Laravel application on a subdomain. I created a folder and assigned it to the subdomain I followed your steps but still getting 500 error

1 like
waqassth's avatar

@vincent15000 Yes I generated But What I figured out its permission issue I tried different other projects to run but it's the same for all I uploaded a new file and on my local i was running it by php artisan serve and npm run dev command but unable to run npm commands on ionos server

1 like
vincent15000's avatar

@waqassth In production, you can't run npm run dev.

You can build the project locally with npm run build and send the public/build folder to production.

aminsbeity's avatar

@waqassth i need your help please in deploying a laravel application to IONOS shares hosting. i did check and test the below 1- composer version >= 8.2 solved 2- data base connection solved 3- log in form is displayed properly

my problem is when i enter my username and password and click login it gives me 500 internal server error. also when i try to click on forget password it gives me same also 500 internal server error.

i did't use you .htaccess above because i remove public folder when i deploy my laravel project

Please or to participate in this conversation.