FOS/RestBundle 升级后报错如下: 将在/config/service.yml中的 修改为: 即可
Category: PHP
一个Symfony项目更新报错
你个2018年的项目要进行升级。由Symfony4.1升级到4.4, 升级过程解决了内存报错后,又出现以下错误. Google出是DoctrineMigrationsBundle由2.x升级到3.x引起的,需要修改/config/doctrine_migrations.yml 修改之前: 修改之后: 修改完成后, 运行 更新顺利完成 参考: https://github.com/doctrine/DoctrineMigrationsBundle/issues/338 https://github.com/doctrine/DoctrineMigrationsBundle/blob/master/UPGRADE.md
突破Composer 安装时内存大小限制
composer update 时报以下错误: Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52 使用Symfony的composer命令突破composer 内存限制问题, 不用修改php.ini中的memory_limit配置. symfony composer update
Rest FUll API 中添加WTI LIKE POST 插件的喜欢数。
WordPress 的 WTI LIKE POST 插件的喜欢数默认是添加在Content中的,而在Wordpress 的REST FULL API 中没有喜欢数相关字段,只需在wti_like_post.php中添加以下代码就能够在RESTFULL API中添加likes字段了: add_action( ‘rest_api_init’, function () { register_rest_field( ‘post’, ‘likes’, array( ‘get_callback’ => function( $post_arr ) { return GetWtiLikeCount($post_arr[‘id’]); }, ‘schema’ => array( ‘description’ => __( ‘Likes .’ ), ‘type’ => ‘integer’ ), ) ); } ); 当API请求时,文章内容中不显示点赞按钮, 在wti_like_post_site.php中的函数function PutWtiLikePost($content) 添加以下代码, if( isset($_SERVER[‘REQUEST_URI’]) && strpos($_SERVER[‘REQUEST_URI’],’/wp-json/wp/v2/’)!== false…
PHP需要配置的几个参数
date.timezone = “Asia/Shanghai” post_max_size = 20M upload_max_filesize = 20M memory_limit = 2000M max_execution_time=700 max_input_vars=10000 max_input_vars参数会影响到Post过去的数组大小. 这个值默认是1000, 当Post的数组大于1000个时,在PHP中取不到下标大于1000的值了.而且这个参数不能通过ini_set设置.只能通过php.ini修改或httpd.conf设置
一次PHP狂占内存经历
更新系统后, 一经调用PHP接口,PHPFPM一起来就疯狂占用内存. 经查是Monolog启用的info日志, info设置的日志如下: monolog: handlers: … … info: type: stream path: “%kernel.logs_dir%/%kernel.environment%-info.log” level: info channels: [‘!event’, ‘!doctrine’, ‘!console’ 删除该配置后系统恢复正常.
How to activation PHPStorm 2017 — 2018 License Server
http://nodde.ru:1027 https://roothat.ru/how-to-activation-phpstorm-2017-2018-license-server/
phpstorm setup
Download https://www.jetbrains.com/phpstorm/ PhpStorm 2017.3.4 License Server http://license.topnguyen.net Install Symfony Plugin in PhpStorm Open PhpStorm Menu Perferences -> Plugins -> Browser Repositories Search “Symfony Plugin” Install -> OK Install phpunit6 & Setup wget -O phpunit https://phar.phpunit.de/phpunit-6.phar chmod +x phpunit ./phpunit –version Perferences -> Languages & Framworks -> PHP -> Test Frameworks Click “+” -> “PHPUnit Local”…
Homebrew install web development envirment
Nginx brew install nginx PHP brew install php71 brew install homebrew/php/php71-pcntl brew install homebrew/php/php71-xdebug MySQL brew install mysql
PHP Composer
https://getcomposer.org/ Installation curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer Use Chinese Packagist composer config -g repo.packagist composer https://packagist.phpcomposer.com