Recently, I was working on PHP, so I had to take a note of the configuration process to avoid forgetting. PHP installation, configuration I install through source code compilation, the basic steps are as follows: unzip tarxfphp-5.5.12.tar.bz2 $ cdphp-5.5.12 $. configure -- prefixoptmyphp -- with-mysql -- enable-safe-mode -- enabl
Recently, I was working on PHP, so I had to take a note of the configuration process to avoid forgetting. PHP installation, configuration I install through source code compilation, the basic steps are as follows: $ tar xf php-5.5.12.tar.bz2 $ cd php-5.5.12 $ '. /configure ''-- prefix =/opt/myphp'' -- with-mysql'' -- enable-safe-mode ''-- enabl
Recently, I was working on PHP, so I had to take a note of the configuration process to avoid forgetting.
PHP installation and configuration
I install the SDK through source code compilation. The basic steps are as follows:
$ tar xf php-5.5.12.tar.bz2$ cd php-5.5.12$ './configure' '--prefix=/opt/myphp' '--with-mysql' '--enable-safe-mode' '--enable-ftp' '--enable-zip' '--with-jpeg-dir' '--with-bz2' '--with-png-dir' '--with-freetype-dir' '--with-iconv' '--with-libxml-dir' '--with-xmlrpc' '--with-zlib-dir' '--with-gd' '--enable-gd-native-ttf' '--with-curl' '--with-gettext' '--with-pear' '--enable-fpm' '--enable-fastcgi' '--with-ncurses' '--with-mcrypt' '--with-mhash' '--with-openssl' '--with-pcre-dir' '--enable-pdo' '--enable-phar' '--enable-json' '--enable-mbstring' '--with-pdo-mysql' '--with-pdo-sqlite' '--with-readline' '--enable-bcmath'$ make$ sudo make install
After the installation is complete, go to the installation directory and modify the configuration file lib/php. ini (if not, create it) and add the time zone settings:
date.timezone=Asia/Shanghai
Then run the FastCGI service of PHP:
./bin/php-cgi -b 9000
Nginx Configuration
Nginx can be installed directly from the Repository:
sudo pacman -S nginx
Or:
sudo apt-get install nginx
After the installation is complete, modify the configuration and add a new Virtual Host:
server { listen 8000; server_name localhost; root /var/www; location / { index index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name; }}
Then create the file/var/www/index. php.
Now you can access http: // 127.0.0.1: 8000/in a browser.
Original article address: nginx + php + FastCGI configuration. Thank you for sharing it with me.