Symfony学习笔记(1):安装

时间:2022-10-25 16:47:48

---恢复内容开始---

1,下载Symfony

  到Symfony官网下载框架,网站为:http://www.symfony.com/。

2,解压到项目根目录下面,Symfony文件夹的结构如下:

www/ <- 你的站点根目录
    Symfony/ <- 压缩包里的Symfony目录
        app/
            cache/
            config/
            logs/
        src/
            ...
        vendor/
            ...
        web/
            app.php
            ...
3,访问 http://127.0.0.1/ShopCar/Symfony/web/config.php,出现界面如下:
Symfony学习笔记(1):安装

Symfony学习笔记(1):安装

 
Symfony学习笔记(1):安装
出现问题如下:
1.Install and enable the mbstring extension.
解决方法,安装mstring扩展,方法可以参考 http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html中的mysqli安装过程,安装完成后界面显示如下:
Symfony学习笔记(1):安装
2,问题2:Install and enable the intl extension (used for validators)
解决方法同上,解决完成后的界面如下:
Symfony学习笔记(1):安装
3.问题3:Install and enable a PHP accelerator like APC
解决方法:
 
login to server as root and run the following commands:

Code:
cd ~ 
mkdir setups
cd setups 
wget http://pecl.php.net/get/APC-3.1.5.tgz 
tar -xvf APC-3.1.5.tgz 
cd APC-3.1.5
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php config=/usr/local/bin/php-config
make
if you get the error:
Code:
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:52: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c:362: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_compile_array':
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_match_array':
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
Then you need to install pcre and make sure you do this from the / directory or it will not install.
Code:
yum install pcre-devel
Again do:
Code:
make
If no errors then do:
Code:
make install
update php.ini through WHM PHP Configuration Editor. Switch to Advanced and find Section:Core Directive:extension and add this to the end of the list:
Code:
, apc.so
Then restart apache and your done. the phpinfo function should show that APC is installed

Hope this helps someone.
 
解决后的界面如下:
  Symfony学习笔记(1):安装