Symfony(3)Environment Update and Configure

宋大人 2014-06-10

Symfony(3)Environment Update and Configure

1. PHP Enhancement
When I try to run the Command 
>composer install
Loading composer repositories with package information

I get this Error Message
guzzle/guzzle v3.8.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.

Solution:
Check the curl on my machine
>curl -V
curl 7.28.1 (x86_64-apple-darwin12.2.0) libcurl/7.28.1 OpenSSL/1.0.1g zlib/1.2.8 libidn/1.25Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

>which curl
/opt/local/bin/curl

Header files are here:
/opt/local/include/curl

Then rebuild the PHP with the parameter —with-curl
>./configure --prefix=/Users/carl/tool/php-5.5.13 --with-openssl --with-iconv-dir=/usr/lib --with-curl=/opt/local/include/curl

Check if the environment is Good now.
>php -m
[PHP Modules] Core ctype datecurl
dom

Good, I have curl there now.

Rebuild the PHP with this command
>./configure --prefix=/Users/carl/tool/php-5.5.13 --with-openssl --with-iconv-dir=/usr/lib --with-curl=/opt/local/include/curl --with-apxs2=/opt/httpd/bin/apxs --with-mysql

2. Apache HTTP Server Configuration
>apachectl -version
Server version: Apache/2.2.26 (Unix) Server built:   Dec 10 2013 22:09:38

But I prefer to compile and install the apache manually.
>wget http://mirror.reverse.net/pub/apache//httpd/httpd-2.4.9.tar.gz
Unzip the file and enter that directory
>cd /Users/carl/data/installation/httpd-2.4.9
>./configure --prefix=/Users/carl/tool/httpd-2.4.9 --enable-so --enable-proxy --enable-proxy-ajp --enable-proxy-http --enable-proxy-ftp --enable-proxy-connect --enable-proxy-balancer

or

>./configure —prefix=/Users/carl/tool/httpd-2.4.9 --enable-modules=all --enable-so

>make

Error Message:
libtool: link: cannot find the library `/opt/local/lib/libexpat.la' or unhandled argument `/opt/local/lib/libexpat.la' make[2]: *** [htpasswd] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1

Solution:
Install APR
>wget http://www.poolsaboveground.com/apache//apr/apr-1.5.1.tar.gz
>./configure --prefix=/Users/carl/tool/apr-1.5.1
make and make install after that
>sudo ln -s /opt/apr-.1.5.1 /opt/apr
Add to the PATH

Install apr-util
>wget http://www.poolsaboveground.com/apache//apr/apr-util-1.5.3.tar.gz
>./configure --prefix=/Users/carl/tool/apr-util-1.5.3 --with-apr=/opt/apr
make and make install after that.

Install PCRE
>wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
>./configure --prefix=/Users/carl/tool/pcre-8.35
make and make install

Let Install HTTPD again
>./configure --prefix=/Users/carl/tool/httpd-2.4.9 --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-pcre=/opt/pcre
make and make install.

>apachectl -version
Server version: Apache/2.4.9 (Unix) Server built:   Jun  5 2014 13:47:11

Then I go on to configure the HTTPD, we face a lot of Error Messages as follow when I configure HTTPD
Error Message
web/.htaccess: <IfModule not allowed here

Error Message
Directory index forbidden by Options directive

Error Message
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'
PHP Fatal error:  Call to undefined function \\SDK\\mcrypt_get_iv_size()

Error Message
configure: error: *** libmcrypt was not found

Error Message
rfc2440.c:26:10: fatal error: 'malloc.h' file not found

Error Message
-bash: aclocal: command not found

Solution:
>sudo chmod -R 777 /Users/carl/work/symfony/myfirstproject/app/cache/

Install libmcrypt 
>wget http://iweb.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
configure, make, sudo make install

Install libmhash
>wget http://tcpdiag.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
configure, make, sudo make install

/usr/include/sys/malloc.h
/usr/include/malloc/malloc.h

>sudo ln -s /usr/include/malloc/malloc.h /usr/include/malloc.h

Install mcrypt http://us2.php.net/mcrypt

>wget http://hivelocity.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
configure, make, sudo make install

Install automake 
>wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
configure, make, sudo make install

Install the PHP extension
>cd php-5.5.13/ext/mcrypt/
>phpize
>aclocal
configure, make, sudo make install
Installing shared extensions:     /Users/carl/tool/php-5.5.13/lib/php/extensions/no-debug-zts-20121212/

Find php.ini and add this line
extension=mcrypt.so

3. How to configure Web Server
Some Important Configuration in httpd.conf
LoadModule php5_module modules/libphp5.so
ServerName 127.0.0.1:80

# Virtual hosts Include conf/extra/httpd-vhosts.conf

<FilesMatch \.php$>    SetHandler application/x-httpd-php </FilesMatch>

Here is the configuration on httpd-vhosts.conf
<VirtualHost *:80>    

  ServerAdmin [email protected]    

  DocumentRoot "/Users/carl/work/winner/winner-seller-console/mytodo/dist"         ServerName uiseed.sillycat.com    

  <Directory "/Users/carl/work/winner/winner-seller-console/mytodo/dist">         

    AllowOverride All         

    Require all granted    

  </Directory>    

  ErrorLog /var/log/apache2/uiseed_err.log    

  CustomLog /var/log/apache2/uiseed.log combined

</VirtualHost>

Haha, the first part is a configuration to load the angular projects. Not the symfony.

Here is the part to load symfony project.

<VirtualHost *:80>       

  ServerName sdk-consumer.local.sillycat.com       

  DocumentRoot /Users/carl/work/symfony/myfirstproject/web        

  <Directory "/Users/carl/work/symfony/myfirstproject/web">                AllowOverride All         

 Require all granted       

  </Directory>        

  ErrorLog  /var/log/apache2/sdk-consumer_err.log       

  CustomLog /var/log/apache2/sdk-consumer.log combined       

  SetEnv SYMFONY_ENV local       

  SetEnv SYMFONY_DEBUG 1

</VirtualHost>

Start to work on further.

References:
http://www.php.net/manual/en/curl.installation.php
http://stackoverflow.com/questions/4976971/compiling-php-with-curl-where-is-curl-installed

Apache HTTP Installation
http://httpd.apache.org/docs/trunk/install.html
http://httpd.apache.org/download.cgi#apache24
http://sillycat.iteye.com/blog/795517
http://sillycat.iteye.com/blog/562651
http://ajiewps.sinaapp.com/?p=226

http://sillycat.iteye.com/blog/563656
http://sillycat.iteye.com/blog/563657

PHP from Apache2
http://sillycat.iteye.com/blog/2066063
http://sillycat.iteye.com/blog/1638638

http://www.php.net/manual/en/install.unix.apache2.php
http://www.madcapsule.com/blog/php-mcrypt-magento-error
http://coolestguidesontheplanet.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/
http://www.glenscott.co.uk/blog/install-mcrypt-php-extension-on-mac-os-x-lion/

configure web server
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
http://bordenia.wordpress.com/2012/04/14/deploying-your-symfony-2-0-web-app-to-the-production-server/

相关推荐