Closed ahoiroman closed 5 months ago
Appears to be a difference between PHP's CLI and FPM implementations. Not sure if it's indirectly impacted by Nginx.
While you can override and specify your own directory via sys_temp_dir
in php.ini
, there doesn't appear to be an option to make it passthru the MacOS actual directory name.
There's a comment in the php docs site that suggests Linux (which MacOS takes from) has a private mode where it doesn't passthrough the actual directory path. I imagine that Apple's escalation of insulating us from access to the underlying OS probably is blocking that.
@drbyte should we add something to the docs about this?
It kinda depends on why sys_get_temp_dir()
is even being called.
It is certainly more preferable for temp files to be created in a directory that's automatically cleaned up by the OS, rather than relying on PHP to do garbage-collection.
@ahoiroman Can you explain what you were trying to do in your app that exposed this? What is this "preventing" you from doing? Was it because you were calling the function directly? Or was something else calling it behind-the-scenes?
Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this.
Description
When using valet's NGINX, I am getting a wrong temp directory (
/var/tmp
) instead of/var/folders/7s/jq24sk81665c1j4y3v9l3vth0000gn/T
.If I use php-cli/tinker to invoke a class, the correct temp directory is returned.
Even if I send a HTTP request to the built-in webserver laravel provides, the path
/var/folders/7s/jq24sk81665c1j4y3v9l3vth0000gn/T
is returned.Steps To Reproduce
Add this to an API-endpoint and call it via valet/nginx or invoke it directly using tinker(well).
Diagnosis
sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
composer global diagnose
composer global outdated
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --formula --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
brew outdated
brew tap
php -v
which -a php
php --ini
nginx -v
curl --version
php --ri curl
/opt/homebrew/bin/ngrok version
ls -al ~/.ngrok2
brew info nginx
brew info php
brew info openssl
openssl version -a
openssl ciphers
sudo nginx -t
which -a php-fpm
/opt/homebrew/opt/php/sbin/php-fpm -v
sudo /opt/homebrew/opt/php/sbin/php-fpm -y /opt/homebrew/etc/php/8.3/php-fpm.conf --test
ls -al ~/Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew
ls -al /Library/LaunchDaemons | grep "com.laravel.valet."
ls -aln /etc/resolv.conf
cat /etc/resolv.conf
ifconfig lo0
sh -c 'echo "------\n/opt/homebrew/etc/nginx/valet/valet.conf\n---\n"; cat /opt/homebrew/etc/nginx/valet/valet.conf | grep -n "# valet loopback"; echo "\n------\n"'
sh -c 'for file in ~/.config/valet/dnsmasq.d/*; do echo "------\n~/.config/valet/dnsmasq.d/$(basename $file)\n---\n"; cat $file; echo "\n------\n"; done'
sh -c 'for file in ~/.config/valet/nginx/*; do echo "------\n~/.config/valet/nginx/$(basename $file)\n---\n"; cat $file | grep -n "# valet loopback"; echo "\n------\n"; done'