Laravel Valet logs - php

I'm using laravel valet to serve sites in my local dev env, which is great. However, there's only one file in the expected location of ~/.valet/Log:
➜ ls ~/.valet/Log
nginx-error.log
I've tinkered with php-fpm log settings and the nginx log settings, but I'm not sure that I'm even using the right config files, since I suspect that valet installs its own version of PHP and nginx.
Can any one tell me where the php / nginx config files for valet would be found, and what specific settings to change to drop the PHP error / log files where they're supposed to be written?

Hopefully this helps with your question about the nginx config files. You can find the nginx configuration for your sites by running cd ~/.config/valet/Nginx in your terminal. To get to the base nginx config for valet use cd /usr/local/etc/nginx/valet. You should then see valet.conf, inside you can update the following lines to put the log files where you want them.
access_log "/Users/[user_id]/.config/valet/Log/access.log";
error_log "/Users/[user_id]/.config/valet/Log/nginx-error.log";
Make sure to run valet restart after you make changes to the valet.conf file.

The NGINX configuration file should be available at /usr/local/etc/nginx/nginx.conf

Related

how to clear cache of laravel app in centos server that uses nginx

enter image description herei'm using centos to host my laravel application,
when i upload the project first time using git, it will be cached, and when i change any file, changes doesn't apply, i tried all artisan commands that clear cache in laravel but didn't fix
the only way is to change the root directory of the application after each single change, is centos caching or nginx or laravel or other software in the server or the browser? even i cleared every thing in public/index.php and put echo 'foo'; and still got old cached data
screenshot of my nginx config file
screenshot of my nginx config file
This is possibly directory permission issue you need to grant storage and bootstrap directory 777 permission level. You need to run the following command on the root folder of your app
chmod -R 777 storage
and
chmod -R 777 bootstrap
Then try to effect your changes.
i tried systemctl restart php-fpm now every thing worked as expected and all changes applied thank you a lot i appreciate your help

apache temporarily VirtualHost by script start

Let's say I have a local apache2 and I need a script that runs the apache2 with a special injected VirtualHost.
More presice:
I have a xampp Installation (PHP 7.3.10, MariaDB 10.4.8, mysqlnd 5.0.12-dev, Apache 2.4.41) on Windows 10.
Several PHP projects are located all over the hard drive. Until now I modify the ./apache/conf/extra/httpd-vhosts.conf file before starting the apache2 service on every project switch. With that I can leave the project folders where there are without copying them in the xampp installation folder.
Now I am curious if I can write a script for each project (bat or sh, GitShell is installed) that will run mariadb normally and apache2 with a temporarily VirtualHost for that specific project folder as DocumentRoot.
What I currently can do:
Lay down a httpd-vhosts.conf file and a startProject.sh script in a project folder. Running the script will copy the configuration file in the xampp installation and then start the apache2 service.
That is working, but only one apache2 process can start and not multiple projects at once.
What I want:
I want to use a parameter that specifies a VirtualHost by parameter when starting apache2.
Maybe by saying apache2 to use a special config file rather then the file in the own project structure.
Or I want to use a parameter by starting the apache2 process that specifies a alternatie DocumentRoot Folder for a already specified VirtualHost.
Currently this is my approach:
#!\bin\bash
BASEDIR=$(dirname "$0")
xamppPath="C:\xampp\v7.3.10"
cd $xamppPath
"apache\bin\httpd.exe" -S "$BASEDIR\httpd-vhosts.conf" &
But -S only prints out the VirtualHosts, not setting the configuration file.
How can I achieve running a project with a script somewhere on my harddrive without overriding the existing configuration file in the xampp installation folder?
Easier: build a couple of congratulation files, use option -f to specify an effective configuration file, not -S.
Can be more complicated: user -D name and use <IfDefine name> in the configuration file to "select" sections of it to apply to a particular start.
Note: I use apachectl, not directly httpd to start/stop Apache.
In the xampp package there is no direct apachectl file, so a use of -D <name> is not possible for me. It would be the perfect solution, but unfortunately not possible.
Now I have to override the httpd-vhosts.conf file from every project I want to start it. Therefore, I am using a modified script solution:
#!\bin\bash
BASEDIR=$(dirname "$0")
xamppPath="C:\xampp\v7.3.10"
cp -f "$BASEDIR\httpd-vhosts.conf" "$xamppPath\apache\conf\extra\httpd-vhosts.conf"
sleep 1
cd $xamppPath
"apache\bin\httpd.exe" &
It is not the perfect solution, but it works.
Two apache services at the same time with two different projects is not possible, but until now not necessary.

"localhost" always shows "welcome to Nginx" Ubuntu?

I am running Ubuntu 16. I am fairly new to web design but I have set up a LAMP server on my Ubuntu machine and installed WordPress site. I wanted to try to mess around with PHP so I tried to install myphp.
I managed to do this and I realized that I had to install nginx also.
I did this, but my local host always diverts to a message "welcome to Nginx"
I tried to edit the configuration files but could not get it to work?
Is there a guide for installing Nginx and myphp to see phpMyAdmin, after you have already set up a WordPress site?
Like I said I am running Ubuntu 16.04.
You may need to delete the index.html file from the web root. The index.php file should remain.
On Ubuntu+nginx go to html directory using following command
cd /var/www/html/
then find out following index.nginx-debian.html and delete it or edit it as you want
To edit these file open into you editor or use Ubuntu default editor nano.
sudo nano /var/www/html/index.nginx-debian.html
To delete these file run following command.
sudo rm -rf /var/www/html/index.nginx-debian.html
these is the defautl nginx welcome page that why it appear after install, for more information check nginx default configuration file using following command.
sudo nano /etc/nginx/sites-available/default
Thanks

localhost does not work after installing macports

I have installed macports and updated my path:
via docs:
http://guide.macports.org/#installing.shell.postflight
but now if I test any of the sites in my Sites folder, I get a 404.
so for instance if I go to localhost/~carey/test.php which is just a php_info, I get a 404
If I go to:
localhost/
I get the It Works! page
Am I missing a step to configure Macports to run apache from my Sites directory?
If I run $env from the command line I get:
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/rs/943jh19j31j3ld55yxqgf2mm0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-NehzDd/Render
TERM_PROGRAM_VERSION=326
TERM_SESSION_ID=A329EAC2-AE9F-4460-BB1B-B35981BAE0ED
USER=carey
SSH_AUTH_SOCK=/tmp/launch-CgUaVv/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
__CHECKFIX1436934=1
PWD=/Users/carey
LANG=en_US.UTF-8
SHLVL=1
HOME=/Users/carey
LOGNAME=carey
SECURITYSESSIONID=186b0
_=/usr/bin/env
and I can run any macport install, but I cannot configure the terminal to connect to my localhost in the browser.
So I think I have macports installed correctly, but I dont know how to make it run out of the /opt directory.
I also think this is relative to establishing the env variables, so apache knows to look to the /opt dir, but I don't know how to change it.
I am running Mavericks.
UPDATE
Following the docs recommended by eborisch here:
https://trac.macports.org/wiki/howto/MAMP
I have been able to setup the localhost directory, but still an issue.
Since I have multiple users on the machine, I had to comment out this line in httpd.conf:
Include conf/extra/httpd-userdir.conf
and added this to the httpd-userdir.conf file:
#
# Include user configurations
#
Include /private/etc/apache2/users/*.conf
which connects my Sites folder to the localhost.
I also needed to add this to the httpd.conf file to parse php files as php:
AddType application/x-httpd-php .php
Now, I have a file in my Sites dir called test.php, which has <?php phpinfo() ?>
and if I run localhost/~carey/test.php in the browser it works. phpinfo() returns that I am running php5.5.10 out of the /opt/ dir. So, all seems well. The problem is if I try to run any sites from folders in this directory. It just displays the directory tree, rather than treating it like a site.
For instance if I run,
localhost/~carey/mysite
it just returns:
Index of /~carey/mysite
Parent Directory
2005/
2006/
index.php
../
If I run
localhost/~carey/mysite/index.php
it runs that file correctly (ie looks correct in the browser)
Seems like an .htaccess issue, but not sure how I would resolve that globally for each folder in the Sites directory
any suggestions?
Probably better served on https://lists.macosforge.org/mailman/listinfo/macports-users/ the macports mailing list. But some basics:
Is the osx web server running? (Web sharing under the sharing control panel?) If so, turn it off, or configure the two to use different ports.
Is the macports apache2 installed? (sudo port install apache2)
Is it running? (sudo port load apache2)
Have you edited its configuration (/opt/local/apache2/conf/httpd.conf)?
See https://trac.macports.org/wiki/howto/MAMP for instructions on getting things up and running.

Where do I find DocumentRoot on Ubuntu after installing PHP, MySQL and Apache2?

I am new to Ubuntu Linux (version 13.10). I am following this tutorial to install MySQL, PHP, and Apache2.
It installed successfully, but I don't know where to write PHP files that execute when you navigate to the URL localhost/example.php.
I am looking at this link, but I am afraid that maybe it will not work and have to reinstall Ubuntu again.
In a newer version should be in a different path: /var/www/html
With a series of commands you can find:
ls /etc/apache2/sites-available/
That answers with something like
000-default.conf default-ssl.conf
In this case you need the second file default-ssl.conf; with
grep -n -e "DocumentRoot" /etc/apache2/sites-available/default-ssl.conf
you can obtain:
5: DocumentRoot /var/www/html
That means you can find (and change) DocumentRoot definition in the 5-th lines of the file /etc/apache2/sites-available/default-ssl.conf.
As a simple Google search would have showed you, it's (by default), /var/www/.
In the Ubuntu default config, that is defined in the default virtual host, the config file for that is /etc/apache2/sites-available/default
The default location of document root is /var/www. This, assuming you haven't touched the HTTPd configuration.
By the way, if you simply need a development server for PHP scripts, you can use the one emebedded in PHP > 5.4. Just cd to the project directory and launch:
php -S localhost:8008
In vscode (I'm sure in other editors as well) you can right click the file and copy path and copy relative path.
http://127.0.0.1:8000/site.php
Works for me.

Categories