R
Join ServerRailway
✋|help
I can't deploy a PHP application using Slim Framework
I have a simple application that uses slim framework:
https://github.com/felinto-dev/wp-package-parser-api-php
but I receive this error in railway deployment:
https://github.com/felinto-dev/wp-package-parser-api-php
but I receive this error in railway deployment:
sh: 2: daemon: not found
sh: 4: worker_rlimit_nofile: not found
sh: 6: events: not found
sh: 7: worker_connections: not found
sh: 8: Syntax error: "}" unexpected
sh: 2: daemon: not found
sh: 4: worker_rlimit_nofile: not found
sh: 6: events: not found
sh: 7: worker_connections: not found
sh: 8: Syntax error: "}" unexpected
sh: 2: daemon: not found
sh: 4: worker_rlimit_nofile: not found
sh: 6: events: not found
sh: 7: worker_connections: not found
sh: 8: Syntax error: "}" unexpected
Server starting on port 6615
nginx: [emerg] open() "/conf/mime.types" failed (2: No such file or directory) in /nginx.conf:11
3 Messages Not Public
Sign In & Join Server To View
@Willian
@codehaven
this should be fixed now, could you try redeploying and let me know how it goes?
@codehaven
this should be fixed now, could you try redeploying and let me know how it goes?
Message Not Public
Sign In & Join Server To View
Do you have an index.php file?
Message Not Public
Sign In & Join Server To View
Well unfortunately it looks like PHP apps on railway aren't quite fixed yet, I know zero about PHP so the best advice I could give would be to put together your own Dockerfile for your app
2 Messages Not Public
Sign In & Join Server To View
I get the same error
I didn't know I could put personalized dockerfile on Railway. How is resource allocation control done so that I do not pay more than it is necessary for my application to work?
Message Not Public
Sign In & Join Server To View
Your app always has access to the maximum amount of resources for your plan (8GB ram 8vCPU for dev plan). It’s up to what your app uses for how much you’ll pay
Is someone has an example about how to deploy a PHP application using Apache for Railway app ?
this is a known problem, hopefully fix coming soon
PHP should be fixed soon.
I don't feel confident using railway's PHP builder because I need to set custom values in php.ini and my "index.php" is currently in "public/index.php" and not in the main directory. I couldn't find any documentation or template about it.
You don't need to set any custom values
And if it's Laravel, it automatically uses
public/
i'm using slim framework
how railway can figure out this ?
Figure out what exactly?
And actually I guess it won't autodetect Laravel if it isn't laravel
I'll fix that in a bit
1. I'm using "public/index.php" and not "index.php"
2. post_max_filesize should be 50MB
2. post_max_filesize should be 50MB
Ah. The first one I'll fix in a bit, and the second one should be fine to set in
php.ini
I use apache mod_rewrite to avoid the user needs to type "public/index.php" in browser
Ah, Railway uses nginx instead of apache by default
I need to create a nginx.conf in the main directory ?
No; nixpacks creates it for you.
how could I get the same result and avoid the user needs to type "public/index.php" ?
I want the user just type the domain
and that's it
As I said, I'll fix that in a bit, and it should be the default behavior soon.
thanks 🙂
@aleks do you will tell us here when you fix the issue ?
@Felinto
Changes Should be live, can you try deploying again and let me know how it goes?
Changes Should be live, can you try deploying again and let me know how it goes?
Message Not Public
Sign In & Join Server To View
I received the same error again
you can check the code repository
https://github.com/felinto-dev/wp-package-parser-api-php
https://github.com/felinto-dev/wp-package-parser-api-php
I know that is not necessary
.htaccess
but I use apache in development environment.take a look at this
https://github.com/railwayapp-templates/laravel/blob/main/.htaccess
.htaccess
filehttps://github.com/railwayapp-templates/laravel/blob/main/.htaccess
its been a very long time since ive had to write htaccess rules, so im no help there
but the problem is not
.htaccess
you guys use nginx
maybe @aleks could look ?
you have a good point there, why would the railway provided template have a htaccess file then
please dont directly ping team / conductor
Is there anything I can do to resolve this issue?
try setting the NIXPACKS_PHP_ROOT_DIR = /public
environment variable, right ? ok, i'll check
service variable in the service settings
done
I'll wait and check
I'll wait and check
I receive the 404 error now
maybe is that the reason ? I'll check
I removed the slash
(because relative path...) and the issues continue
(because relative path...) and the issues continue
i can see how this would be frustrating, i will bring this up to aleks
sorry for the poor php support
sorry for the poor php support
Thank you for understanding
Ah, try setting NIXPACKS_PHP_ROOT_DIR=/app/public
I'm not sure if that will help, but it might
It worked! Thanks 🙂
Great!
Also, if you want to have a custom configuration, it should now be possible.
Do you know what the PHP server resolves for
I need to create a temporary directory but I don't get the right permissions
$_SERVER["DOCUMENT_ROOT"]
?I need to create a temporary directory but I don't get the right permissions
maybe I will need to use environment variables 😦
php.ini, right ? I'll check
nginx.conf
I'm pretty sure it should use your
public/
dir; that's the root passed to the NGINX configuration.How could I simulate the same environment of railway in my computer to test this issue ?
to avoid do a lot of "trash commits" in git repository
You should be able to download Nixpacks from https://github.com/railwayapp/nixpacks, and then (assuming you have Docker installed) run
nixpacks build . --name <image name>
and docker run -p 8080:80 -it <image name>
It should be running as root anyway, so there shouldn't be any permission issues.
the files are from the
root
userbut the PHP server run using the "nobody" user
and that the reason because I can't create the folder
do you have any suggestion ?
the fs is frozen at built time
Huh, that's interesting. I haven't dug into that part of the codebase in a bit.
so you cant create any new folders
No, it isn't.
on railway it is?
Nope.
Just not persisted across deployments.
you can create new files but no folders?
You can create folders.
And files.
im 90% sure you cant