Showing posts with label xampp. Show all posts
Showing posts with label xampp. Show all posts

Monday, December 26, 2022

Where can I find the MySQL log file in XAMPP - Activate logs in Xampp-Mysql

I use PHP (PDO) to access MySQL in XAMPP. My question is where I can find the MySQL query log, exact query that executed on MySQL server?
You need to run these two queries:

SET GLOBAL general_log = 'ON';

SET GLOBAL general_log_file = 'my_log.log';
First will enable loging (which may be off by default)

and the second select updates the preferred file (by default under C:/xampp/mysql/data/)
NOTE: On windows 8 you may have to run your SQL IDE as ADMINISTRATOR for this commands to get saved.
You can also set this in the config, go to path_to_xampp/mysql/ and edit my.ini (copy from my-default.ini if it does not exists) and add the settings there:
[mysqld]

general_log = 'ON';
general_log_file = 'my_log.log';

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
You can view your query logs like below window:
Step1: You need to install Git Bash
Step2: Open Git Bash terminal and navigate to xampp_install_directory/mysql/data directory
Step3: Run command tail -f my_log.log


Thursday, March 9, 2017

How to Install CakePHP in XAMPP

CakePHP is a free, open-source, rapid development framework for PHP. CakePHP is most popular PHP frameworks today.

The very first thing is to need download CakePHP from here
Then extract it in xampp/htdocs folder as below screenshot:


Next is to browse application: http://localhost/cake/ which will look like below screenshot:


Now open "C:\xampp\htdocs\cake\app\Config\core.php" and change value of following properties "Security.salt" and "Security.cipherSeed".

It will remove first 2 errors.

Then its time to connect the application to MySQL database. To do so first rename the file "C:\xampp\htdocs\cake\app\Config\database.default.php" to "C:\xampp\htdocs\cake\app\Config\database.php" and edit the file as follows:

class DATABASE_CONFIG {
    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => '',
        'database' => 'cake',
        'prefix' => '',
        'encoding' => 'utf8',
    );
}


And finally:

To change the content of home page, edit: APP/View/Pages/home.ctp.
To change layout, edit: APP/View/Layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.

Thursday, November 3, 2016

How to install Laravel 5 with Xampp (Windows)

Requirements:
1. PHP 5.5.9 or above
2. OpenSSL PHP Extension
3. PDO PHP Extension
4. Mbstring PHP Extension
5. Tokenizer PHP Extension

First of all, we need Xampp, so we can download it from the official page

After you've downloaded and installed Xampp, we need to install Composer from official page

After install it, we can open a Windows terminal and write composer for execute the command:




We will configure a Virtual Host in Xampp for a Laravel project, and in this example, we want to configure the domain laravel.local for our project.
We need to edit httpd-vhosts.conf that is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf and add following lines at the end of the file:


<VirtualHost laravel.local:80>
    DocumentRoot "C:\xampp\htdocs\laravel\public"
    ServerAdmin laravel.local
    <Directory "C:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Now we have to configure our hosts file that allows to redirect laravel.local to the localhost that is located in C:\Windows\System32\drivers\etc, add "127.0.0.1 laravel.local" to the  end of the file named "hosts".

We are prepared to install and configure a Laravel Framework. First of all, we have to navigate to "C:\xampp\htdocs" folder to install it and run this following command:


composer create-project laravel/laravel your_folder







Finally, have to start our Apache and MySql from Xampp control panel



And need to start laravel as server using following command:

php artisan serve --port=45

and navigate to http://localhost:45 from browser:


Friday, September 6, 2013

Apache Access Log Rotation In AppServ And Xampp

Apache access log rotation in AppServ and Xampp is disable by default. By default,access log will be created in directory path “xampp/apache/logs/access.log” for Xampp and “AppServ/ApacheX.X/logs/access.log” for AppServ. On a busy server, access log will be grows very fast equal to high traffic for apache server. Without rotation, access.log will be very large. Manual rotation by periodically backup existing log cannot be done while apache server is running. In this case, apache continues writing to access.log until the server is stopped.
Small file log will be lighten work load of apache server, because it’s need more resource to handle writing to a big file. In this tutorial, access.log will be rotate daily base, so the name of log will be “access_year-month-date.log” Ex: access_12-01-01.log for access log at January 1, 2012.

Editing httpd.conf configuration

Edit your httpd.conf in this path “Xampp/apache/conf/httpd.conf” for Xampp and “AppServ/ApacheX.X/conf/httpd.conf” for AppServ. Find the line contains config like this:
1CustomLog "logs/access.log" common
Comment this line by adding # in the beginning of line. Then, add new line bellow old config and fill with this config:
1CustomLog "|bin/rotatelogs.exe logs/access_%y-%m-%d.log 86400" common
Make sure that rotatelogs.exe exist in bin directory. To tell apache should rotate log daily base, we should add numeric value 86400 that means interval in seconds after new file is generated. Number 86400 came from (24 hours * 60 Minutes * 60 Seconds) that means apache log should rotate daily. Don’t forget to savehttpd.conf and restart your apache. After the server up, see at directory path “xampp/apache/logs” for Xampp and “AppServ/ApacheX.X/logs” for AppServ, there is access log with new format name: “access_year-month-date.log”. For more explanation, see Apache HTTP Server Log Files.

Combined Log Format

Another commonly used format string is called the Combined Log Format. It can be used as follows.
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog log/access_log combined
This format is exactly the same as the Common Log Format, with the addition of two more fields. Each of the additional fields uses the percent-directive %{header}i, where header can be any HTTP request header. The access log under this format will look like:
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"
The additional fields are:
"http://www.example.com/start.html" (\"%{Referer}i\")
The "Referer" (sic) HTTP request header. This gives the site that the client reports having been referred from. (This should be the page that links to or includes/apache_pb.gif).
"Mozilla/4.08 [en] (Win98; I ;Nav)" (\"%{User-agent}i\")
The User-Agent HTTP request header. This is the identifying information that the client browser reports about itself.


Saturday, April 6, 2013

How to enable rewrite module in XAMPP, WAMP and Apache

How to enable rewrite module in XAMPP, WAMP and Apache
  1. Open apache’s configuration file using your favorite text editor. The configuration file generally locates at:{apache_dir}/conf/httpd.conf
    If you are using XAMPP or WAMP package then you will find the file at:{xampp_dir}/apache/conf/httpd.conf
    {wamp_dir}/apache/conf/httpd.conf
  2. Search for the following string:#LoadModule rewrite_module modules/mod_rewrite.so and uncomment it (remove the ‘#’ sign).
  3. Now search for another string AllowOverride None and replace it by AllowOverride All
  4. Finally save the changes, close your text editor and restart your apache server.