vercel-community / php Goto Github PK
View Code? Open in Web Editor NEWπ PHP Runtime for β² Vercel Serverless Functions (support 7.4-8.3)
Home Page: https://php.vercel.app
License: MIT License
π PHP Runtime for β² Vercel Serverless Functions (support 7.4-8.3)
Home Page: https://php.vercel.app
License: MIT License
Hello,
I am trying to deploy a php file.
and it builds fine (I think). But whenever I try to access it, the website gives me a 502 error with the following text : 502: BAD_GATEWAY Code: NO_STATUS_CODE_FROM_FUNCTION
I've checked the logs and it seems to be an error when it tries to load a shared library (error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
)
but I'm at a complete loss as to why this has only started to happen today. as it worked fine yesterday. :/
any help would be greatly appreciated.
Hi,
Amazing job, it works like a charm !
I would like to know if you can add the official extension redis v5 on a future release (https://blog.remirepo.net/pages/PECL-extensions-RPM-status) ?
This is the last technical point that I would like to check with a remote redis server for caching php raw data.
Thanks a lot.
Nick
0.3.1
It appears that all files in the now Vercel project root (where .vercel
and/or now.json
are kept) are being sent to the builder for each Serverless Function. It's causing my builds to fail, as my repo as a whole is well over the Lambda max of 50MB, even though each Serverless function is well below that.
My understanding is that each Serverless Function should, by default, include only its own .php
file, plus any matching files explicitly specified in that function's includeFiles
in now.json
.
The example at the repo above is nearly identical to the vercel-examples/php example, just with a 100MB nonsense zip file added to the root directory. It fails to build because Error: The Serverless Function "api/index.php" is 127.22mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size
.
OctoberCMS deployment error, error details are as follows:
11:55:57.022 Retrieving list of deployment files...
11:55:59.059 Downloading 8613 deployment files...
11:56:36.179 Installing build runtime...
11:56:39.304 Build runtime installed: 3125.472ms
11:56:39.641 Looking up build cache...
11:56:39.679 Build cache not found
11:56:44.229 FetchError: request to https://dmmcy0pwk6bqi.cloudfront.net/72fa93338474b73727a4d70b0c643da5286a38f8 failed, reason: getaddrinfo EBUSY dmmcy0pwk6bqi.cloudfront.net
11:56:44.229 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:85863:11)
11:56:44.229 at ClientRequest.emit (events.js:310:20)
11:56:44.229 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:44.229 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:44.229 at TLSSocket.emit (events.js:310:20)
11:56:44.229 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:44.230 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:44.230 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:44.230 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:44.230 message: 'request to https://dmmcy0pwk6bqi.cloudfront.net/72fa93338474b73727a4d70b0c643da5286a38f8 failed, reason: getaddrinfo EBUSY dmmcy0pwk6bqi.cloudfront.net',
11:56:44.230 type: 'system',
11:56:44.230 errno: 'EBUSY',
11:56:44.230 code: 'EBUSY'
11:56:44.230 }
11:56:44.238 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:44.238 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:44.238 at ClientRequest.emit (events.js:310:20)
11:56:44.238 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:44.238 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:44.238 at TLSSocket.emit (events.js:310:20)
11:56:44.238 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:44.238 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:44.238 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:44.238 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:44.238 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:44.239 type: 'system',
11:56:44.239 errno: 'EBUSY',
11:56:44.239 code: 'EBUSY'
11:56:44.239 }
11:56:45.241 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:45.241 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:45.241 at ClientRequest.emit (events.js:310:20)
11:56:45.241 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:45.241 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:45.241 at TLSSocket.emit (events.js:310:20)
11:56:45.241 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:45.241 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:45.241 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:45.241 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:45.241 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:45.241 type: 'system',
11:56:45.242 errno: 'EBUSY',
11:56:45.242 code: 'EBUSY'
11:56:45.242 }
11:56:47.244 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:47.244 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:47.244 at ClientRequest.emit (events.js:310:20)
11:56:47.244 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:47.244 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:47.244 at TLSSocket.emit (events.js:310:20)
11:56:47.244 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:47.244 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:47.244 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:47.244 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:47.244 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:47.244 type: 'system',
11:56:47.244 errno: 'EBUSY',
11:56:47.244 code: 'EBUSY'
11:56:47.244 }
11:56:51.247 FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:51.247 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:51.247 at ClientRequest.emit (events.js:310:20)
11:56:51.247 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:51.247 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:51.247 at TLSSocket.emit (events.js:310:20)
11:56:51.247 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:51.247 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:51.247 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:51.247 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:51.247 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:51.247 type: 'system',
11:56:51.247 errno: 'EBUSY',
11:56:51.247 code: 'EBUSY'
11:56:51.247 }
11:56:51.248 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:51.248 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:51.248 at ClientRequest.emit (events.js:310:20)
11:56:51.248 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:51.248 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:51.248 at TLSSocket.emit (events.js:310:20)
11:56:51.248 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:51.248 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:51.248 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:51.248 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:51.248 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:51.248 type: 'system',
11:56:51.248 errno: 'EBUSY',
11:56:51.248 code: 'EBUSY'
11:56:51.248 }
11:56:52.249 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:52.249 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:52.249 at ClientRequest.emit (events.js:310:20)
11:56:52.249 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:52.249 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:52.249 at TLSSocket.emit (events.js:310:20)
11:56:52.249 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:52.249 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:52.249 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:52.249 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:52.249 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:52.249 type: 'system',
11:56:52.249 errno: 'EBUSY',
11:56:52.249 code: 'EBUSY'
11:56:52.249 }
11:56:54.251 [bld_i9i60y1sk] [now] retrying to patch after FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:54.251 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:54.251 at ClientRequest.emit (events.js:310:20)
11:56:54.251 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:54.251 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:54.251 at TLSSocket.emit (events.js:310:20)
11:56:54.251 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:54.251 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:54.251 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:54.251 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:54.251 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:54.251 type: 'system',
11:56:54.251 errno: 'EBUSY',
11:56:54.251 code: 'EBUSY'
11:56:54.251 }
11:56:58.255 worker main FetchError: request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com
11:56:58.255 at ClientRequest.<anonymous> (/var/task/sandbox-worker.js:4408:11)
11:56:58.255 at ClientRequest.emit (events.js:310:20)
11:56:58.255 at ClientRequest.EventEmitter.emit (domain.js:482:12)
11:56:58.255 at TLSSocket.socketErrorListener (_http_client.js:426:9)
11:56:58.255 at TLSSocket.emit (events.js:310:20)
11:56:58.255 at TLSSocket.EventEmitter.emit (domain.js:482:12)
11:56:58.255 at emitErrorNT (internal/streams/destroy.js:92:8)
11:56:58.255 at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
11:56:58.255 at processTicksAndRejections (internal/process/task_queues.js:84:21) {
11:56:58.255 message: 'request to https://api-pdx1.vercel.com/v2/now/deployments/dpl_AnxCrBTB9XtBFm8Ews4ZZvGB9rju/builds/bld_i9i60y1sk failed, reason: getaddrinfo EBUSY api-pdx1.vercel.com',
11:56:58.256 type: 'system',
11:56:58.256 errno: 'EBUSY',
11:56:58.256 code: 'EBUSY'
11:56:58.256 }
11:56:59.587 Done with "api/index.php"
I created a brand new full lumen application startup example.
Unlike laravel, lumen does not require static file caching or access, which allows only one now.json to be started.
See the full code example: https://github.com/OpenEpicData/NowLumenCore
So I'm experimenting with vercel and I'm wondering if session usage is supposed to work (since it's serverless?)
So far, it seems to work but I get something a bit strange
Using the following code
session_start();
$counter = $_SESSION['counter'] ?? 0;
$counter++;
$_SESSION['counter'] = $counter;
echo "counter is $counter";
I got an increment of 1 on my local webserver, but an increment of 2 of my test application running on vercel. No idea why. More generally I'm wondering what happens to temporary files (uploaded files? session files?) when running the php backend.
I know it's a bit outside of vercel-php itself but I'm guessing I may not the only one askying myself these questions?
When I try to POST
to /submit-form
, I get a 405 Method not allowed
from Vercel, even though I specified the methods
in the config. This makes it impossible to submit forms.
Here is my vercel.json
:
{
"functions": {
"api/index.php": {
"runtime": "[email protected]"
}
},
"routes": [
{
"src": "/(.*)\\.(.*)$",
"dest": "src/$1.$2"
},
{
"src": "/(.*)",
"methods": ["POST", "GET"],
"dest": "/api/index.php"
}
]
}
To repro, you can use something like curl
:
https://your-app.vercel.app/submit -X POST
...
<html> <head> <title>Method not allowed</title>
<style>
body{
margin:0;
padding:30px;
font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;
}
h1{
margin:0;
font-size:48px;
font-weight:normal;
line-height:48px;
}
</style>
</head>
<body>
<h1>Method not allowed</h1>
<p>Method not allowed. Must be one of: <strong>GET</strong></p>
</body>
How to deploy typecho with now-php?
https://github.com/typecho/typecho
Really nice project!
I will try to deploy with now my slim api projet.
now.json
{
"functions": {
"public/*.php": {
"runtime": "[email protected]"
}
}
}
composer.json
{
"require": {
"php": "^7.3",
"slim/slim": "^4.3",
"slim/psr7": "^0.6.0",
"vlucas/phpdotenv": "^4.0"
}
}
I got this error log on my now instance :
05:34:54 PM | Downloading 234 deployment files...
-- | --
05:35:07 PM | Installing build runtime...
05:35:10 PM | Build runtime installed: 2752.461ms
05:35:11 PM | Looking up build cache...
05:35:12 PM | π Installing Composer deps.
05:35:12 PM | php: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
05:35:12 PM | Error: Exited with 127
05:35:12 PM | at ChildProcess.child.on (/zeit/fa5b89e012ce722c/.build-utils/.builder/node_modules/now-php/dist/utils.js:151:24)
05:35:12 PM | at emitTwo (events.js:126:13)
05:35:12 PM | at ChildProcess.emit (events.js:214:7)
05:35:12 PM | at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
05:35:12 PM | worker exited with code 1 and signal null
05:35:12 PM | done
05:35:13 PM | Installing build runtime...
05:35:14 PM | Build runtime installed: 491.000ms
05:35:14 PM | Looking up build cache...
05:35:16 PM | π Installing Composer deps.
05:35:16 PM | php: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
05:35:16 PM | Error: Exited with 127
05:35:16 PM | at ChildProcess.child.on (/zeit/fa5b89e012ce722c/.build-utils/.builder/node_modules/now-php/dist/utils.js:151:24)
05:35:16 PM | at emitTwo (events.js:126:13)
05:35:16 PM | at ChildProcess.emit (events.js:214:7)
05:35:16 PM | at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
05:35:16 PM | worker exited with code 1 and signal null
05:35:16 PM | done
05:35:16 PM | Installing build runtime...
05:35:17 PM | Build runtime installed: 518.264ms
05:35:17 PM | Looking up build cache...
05:35:19 PM | π Installing Composer deps.
05:35:19 PM | php: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
05:35:19 PM | Error: Exited with 127
05:35:19 PM | at ChildProcess.child.on (/zeit/fa5b89e012ce722c/.build-utils/.builder/node_modules/now-php/dist/utils.js:151:24)
05:35:19 PM | at emitTwo (events.js:126:13)
05:35:19 PM | at ChildProcess.emit (events.js:214:7)
05:35:19 PM | at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
05:35:19 PM | worker exited with code 1 and signal null
05:35:19 PM | done
05:35:20 PM | Installing build runtime...
05:35:20 PM | Build runtime installed: 408.707ms
05:35:21 PM | Looking up build cache...
05:35:22 PM | π Installing Composer deps.
05:35:23 PM | php: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
05:35:23 PM | Error: Exited with 127
05:35:23 PM | at ChildProcess.child.on (/zeit/fa5b89e012ce722c/.build-utils/.builder/node_modules/now-php/dist/utils.js:151:24)
05:35:23 PM | at emitTwo (events.js:126:13)
05:35:23 PM | at ChildProcess.emit (events.js:214:7)
05:35:23 PM | at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
05:35:23 PM | worker exited with code 1 and signal null
05:35:23 PM | done
05:35:23 PM | Installing build runtime...
05:35:23 PM | Build runtime installed: 415.674ms
05:35:24 PM | Looking up build cache...
05:35:26 PM | π Installing Composer deps.
05:35:26 PM | php: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
05:35:26 PM | Error: Exited with 127
05:35:26 PM | at ChildProcess.child.on (/zeit/fa5b89e012ce722c/.build-utils/.builder/node_modules/now-php/dist/utils.js:151:24)
05:35:26 PM | at emitTwo (events.js:126:13)
05:35:26 PM | at ChildProcess.emit (events.js:214:7)
05:35:26 PM | at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
05:35:26 PM | worker exited with code 1 and signal null
05:35:28 PM | done
Any tips?
Hi, is it possible to use SQLite3 database on this version? I tried creating a demo sqlite.db but it doesn't work. Even a simple "connection" test doesn't work or maybe I forgot something?
Trying to check SQLite version.
$dbh = new PDO('sqlite::memory:'); print_r("SQLite version " . $dbh->query('select sqlite_version()')->fetch()[0]); $dbh = null;
Fatal error: Uncaught Error: Call to a member function querySingle() on null in /var/task/user/api/index.php:27 Stack trace: #0 {main} thrown in /var/task/user/api/index.php on line 27
Thanks!
How to deploy wordpress with now-php ?
Hello.
Great repo.
Thanks!!
But I am running into this issue when trying to send an email from a function
STDERR: sh: /usr/sbin/sendmail: No such file or directory
Could you add an example of how to configure now-php to work with now dev
? On this page it says "check that PHP executable is added to the PATH environment variable". I'm guessing this means create a .env
file and put something like PATH=/β¨usrβ©/localβ©/β¨Cellar/[email protected]β©/β¨7.3.15β©/β¨binβ©/php
in it. Is that right? I tried that and also tried using the path from my .bash_profile
, with no luck.
Forgive my lack of knowledge in php/serverless, you mentioned that the mode is "PHP development server" which gets a flag on php documentation for not being production friendly. Is this normal as it's a now/serverless architecture and all the server load is managed by Now. Can you please shed some light on this?
Thank you!
I need support to enable php-mcrypt on now-php
I get an error when use mcrypt
Fatal error: Uncaught Error: Call to undefined function mcrypt_module_open()
Thank you for support.
Hey there,
I have been loving your php builders and am starting to migrate a bunch of older php stacks to Zeit now.
I have created a quick example to run Codeigniter v3 with your builders.
https://github.com/rolandihms/zeit-php/tree/master/examples/codeigniter
https://zeit-php-e9gik1te9.now.sh/
https://zeit.co/rolandihms/zeit-php/e9gik1te9
Maybe someone might stumble across a requirement for the older framework.
Thanks
Are the vercel env
commands usable for the vercel-php runtime? I want to store some secrets that are encrypted through Vercel. They are stored in my gitignored .env
file. Can I access this in PHP?
How can I remove the error:
Fatal error: Uncaught Error: Call to undefined function imagecreatefrompng() in /var/task/user/api/image.php:8 Stack trace: #0 {main} thrown in /var/task/user/api/image.php on line 8
help plz(
I didnt check if they are valid , but your phpinfo(); leaks
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
-- | --
Hi! Is there any chance we could get the MongoDB extension?
I'm using Laravel and MongoDB but unfortunately the extension is not installed. Cheers!
Hi,
The extensions : redis, igbinary, msgpack and probably some others are missing now on the new php-lib repository.
Can you add them again ?
Thanks a lot for your amazing job !
Nick
As part of my build process I run npm run production
which compiles all my javascript, however a step in my build executes a php script. This seems to fail on ZEIT since php doesn't appear to be available. Currently this means I need to pre-compile my assets and skip zeits build step.
Is there a way to expose php
to my npm build scripts? or alternatively, is there a way to run my npm build scripts as part of the now-php build step?
now dev
(vol2)PHP_CLI_SERVER_WORKERS=2
)Feel free to suggest any feature you like.
Do you have any examples for how to run lambdas in Zeit Now?
I've tried placing scripts in the api/
directory but keep getting a not found page - the one that PHP renders, not Zeit's one.
First of all, thanks for your work with this, it's really great π
I have a question about environments, which is not really clear to me.
This is my PHP-file:
<?php
var_dump(getenv('foo'));
phpinfo();
I deploy it with now.json:
{
"version": 2,
"name": "test",
"builds": [
{
"src": "index.php",
"use": "now-php"
}
],
"env": {
"foo": "foo"
}
}
Thats works as expected and I see string foo dumped with getenv()
.
But if I change env foo in now.json
to something else and redeploy it, the value of foo is still foo. It does not change.
Mabe it's a general problem with now...
use version 0.0.9
, when i open build log in now, seems some php extension load failed
2020-01-28T06:47:36.062Z Looking up build cache...
2020-01-28T06:47:36.149Z Build cache found [119.51 kB, 188 files]
2020-01-28T06:47:36.149Z Build cache unpacked: 87.213ms
2020-01-28T06:47:36.579Z Running builder.exports.build...
2020-01-28T06:47:36.669Z π Installing Composer deps.
2020-01-28T06:47:36.680Z PHP Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/gd (/zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/gd: cannot open shared object file: No such file or directory), /zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/gd.so (libfreetype.so.6: cannot open shared object file: No such file or directory)) in Unknown on line 0
2020-01-28T06:47:36.684Z PHP Warning: PHP Startup: Unable to load dynamic library 'xsl' (tried: /zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/xsl (/zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/xsl: cannot open shared object file: No such file or directory), /zeit/51622c6ed2bac4d4/.build-utils/.builder/node_modules/@now-php/lib-73/native/php/modules/xsl.so (libexslt.so.0: cannot open shared object file: No such file or directory)) in Unknown on line 0
2020-01-28T06:47:36.691Z PHP Warning: Cannot load module 'phalcon' because required module 'psr' is not loaded in Unknown on line 0
2020-01-28T06:47:36.851Z [2.9MiB/0.01s] Loading composer repositories with package information
2020-01-28T06:47:36.854Z [3.1MiB/0.01s] Installing dependencies from lock file
2020-01-28T06:47:36.864Z [3.3MiB/0.02s] Nothing to install or update
2020-01-28T06:47:36.865Z [3.1MiB/0.02s] Generating autoload files
2020-01-28T06:47:36.866Z [3.1MiB/0.02s] Memory usage: 3.13MiB (peak: 3.73MiB), time: 0.02s
2020-01-28T06:47:36.871Z π Installing Composer deps OK.
The PHP error is
Fatal error: Cannot redeclare go() in /var/task/user/kirby/config/helpers.php on line 222
We can not figure out the source of the original go() function that kirby is conflicting with. We've discovered many different forms of using PHP reflection to try and find the source with no luck - https://stackoverflow.com/questions/7026690/reconstruct-get-code-of-php-function - and posting our own question - https://stackoverflow.com/questions/64867808/get-function-definition-in-string-form-in-php
The only hint that we found is that the PHP extension swoole has a go() function that sounds like it may be the conflict (https://github.com/getkirby-v2/kirby/issues/643) however all of our attempts to disable that extension have failed, like overriding the php.ini config. Is there a way to not include that with vercel-php? maybe a past version that doesn't have it? or any other ideas?
Thanks in advance.
Code:
<?php var_dump($_GET);
http://localhost:8080/services/test?test=test&test2=test2
Output:
array(2) {
["?test"]=>
string(4) "test"
["test2"]=>
string(5) "test2"
}
I'm trying to use now dev on windows but i get these messages
> Ready! Available at http://localhost:3000
> Building [email protected]:api/index.php
It looks like you don't have PHP on your machine.
Learn more about how to run now dev on your machine.
https://err.sh/juicyfx/now-php/now-dev-no-local-php
when visiting the url, i get vendor errors like this
Warning: require_once(C:\Users\myusername\AppData\Local\Temp\zeit-fun-0a347cf3b4463\user\api/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\myusername\AppData\Local\Temp\zeit-fun-0a347cf3b4463\user\api\index.php on line 7
is windows supported ? nothing is mentionned in the url now-dev-no-local-php about windows. It seems to work more or less since I'm seeing a warning message, so maybe it's easy to fix.
0.3.1
Vercel requires a function's includeFiles
and excludeFiles
to be a single glob string.
vercel-php
expects an array, or a string. But it trips on many glob matching patterns.
There are two abutting issues:
now.json
vercel.json
file with an array in includeFiles
or excludeFiles
fails validation and refuses to deploy, even though that's what's recommended in vercel-php
's documentation.Error! Invalid now.json - `functions['api/index.php'].excludeFiles` Invalid request: `functions['api/index.php'].excludeFiles` should be string..
vercel-php
seems to trip on many non-trivial glob patterns (basically anything that's beyond a string ending in *
or **
). It will deploy, but with the following behavior:On the first GET request, the request times out with a Vercel 502 NO_RESPONSE_FROM_FUNCTION
error.
Vercel logs show the following:
π Spawning: PHP Built-In Server at /var/task/user (document root) and /var/task/user/api/index.php (router)
2020-08-07T15:41:38.840Z d9691f0f-b896-4a65-8b9e-2182919131a0 ERROR πSTDERR: Directory /var/task/user does not exist.
π PHP Built-In Server process closed code 1 and signal null
2020-08-07T15:41:43.570Z d9691f0f-b896-4a65-8b9e-2182919131a0 ERROR Invoke Error {"errorType":"Error","errorMessage":"connect ECONNREFUSED 127.0.0.1:8000","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8000,"stack":["Error: connect ECONNREFUSED 127.0.0.1:8000"," at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"]}
On all subsequent requests, PHP returns PHP Built-In Server HTTP error: Error: connect ECONNREFUSED 127.0.0.1:8000
.
Vercel logs show:
π Accessing juicyfx-php-test-nl5ugs3i9.vercel.app/api/index.php
π Querying /api/index.php
2020-08-07T15:43:47.070Z bf4f302d-3817-4f32-b291-e81deaf3274f ERROR π PHP Built-In Server HTTP errored Error: connect ECONNREFUSED 127.0.0.1:8000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8000
}
My temporary workaround is to use a single string with a simple glob pattern that vercel-php
does seem to do okay with; in my case: excludeFiles: projects/**
.
Glob patterns I've encountered this issue with:
!(file)
(fileA|fileB)
(doesn't error, but appears to get parsed as a single exact filename, rather than a glob pattern)
**/*
Will there be support for php.ini customization? I'm specifically looking to set session handler to redis store. Thank you.
The function for api/index.php can't be handled by any builder. Make sure it is inside the api/ directory.
I contacted Vercel but they said it's not a problem on their end. Any ideas?
Hi,
Is there a "demo/example" on how to add URL "rewrite rule"?
Is Vercel PHP uses NGINX or APACHE?
Thank you
Here's a 3 min video of what i'm doing and the error im getting... im new to php and github, can someone please let me know where i go wrong?
https://youtu.be/_XMPR79AOgA
I'm considering deploying an app with a sqlite database that will be bundled during deployment. I see that the current sqlite library is quite old (3.7.17 released in 2013)
There has been quite a lot of changes since then. Is it possible to update the version of this library to a more recent one?
Not sure if I need any of the changes, but it makes me wonder :)
Composer scripts run perfectly (thanks!)
"vercel": [
"npm install",
"npm run prod"
]
However the build output (js/css) isn't available after the build is complete. If it helps, I'm using laravel mix
21:03:07.975 | > cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
21:03:20.083 | DONE Compiled successfully in 10120ms3:03:20 AM
21:03:20.087 | Asset Size Chunks Chunk Names
21:03:20.087 | /css/app.css 8.47 KiB 1 [emitted] /js/app-server
21:03:20.087 | /js/app-client.js 169 KiB 0 [emitted] /js/app-client
21:03:20.087 | /js/app-client.js.LICENSE.txt 219 bytes [emitted]
21:03:20.087 | /js/app-server.js 326 KiB 1 [emitted] [big] /js/app-server
21:03:20.087 | /js/app-server.js.LICENSE.txt 219 bytes [emitted]
21:03:20.157 | π Running composer scripts [DONE]
21:03:28.993 | π Creating lambda
21:03:36.877 | Uploading build outputs...
21:03:40.526 | Build completed. Populating build cache...
21:03:48.266 | Uploading build cache [26.75 MB]...
21:03:48.921 | Build cache uploaded: 662.765ms
21:03:48.931 | Done with "api/index.php"
(apologies for the formatting on that)
however /css/app.css
and /js/app-client.js
return 404's when the site is loaded (website if I run npm run prod
locally and commit the output to git: https://phase-blog-demo.now.sh/)
Hello sir, thanks for your great work, if i want to use now-php with pdo_sqlsrv extension, anyway to configure or not supported?
Using the vercel-php runtime, I deployed my API on GoDaddy's domain but through Vercel's servers. As it is an API, I am trying to connect to one of my GoDaddy MySQL databases. I get the following error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'secondissea'@'ec2-13-57-11-140.us-west-1.compute.amazonaws.com' (using password: YES) in ------------
'secondisea' is my database username, and this works locally, because I whitelisted on GoDaddy. After the '@' I am using is Vercel's hosting server. And this entire thing is a PHP error when I am trying to connect to the database.
How do I get rid of this error? Since vercel-php is made for API endpoints, there has to be a solution.
At this moment my project has a .nowignore
file to prevent the composer vendor
directory from uploading to now.
When I run this same project with now dev
I get an error because the vendor
directory is not found. This makes sense because it is ignored.
This should however be resolved by either:
now dev
, but this seems to make it really slow.vendor
directory during a development run. But how can that be done?I want to publish a private composer satis repository to now.sh
However, the project has no PHP files, I need to run composer install
and vendor/bin/satis
on now.sh in order to setup satis.
Can I use this project to do that and how would I go about doing that?
Switch now-php
to newer PHP version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.