我是phantomjs的新手,在标准的centOS服务器上尝试(安装了httpd等,但除了名称服务器设置为8.8.8.8和8.8.4.4之外没有修改过的设置).
我正在使用默认的loadspeed.js文件(重命名).但是,页面速度似乎非常慢.这是一个例子:
$ phantomjs phantomjs.js http://www.google.com/
starting
Loading time 90928 msec
$ phantomjs phantomjs.js http://173.194.67.138/ #(one of google's public ips)
starting
Loading time 30204 msec
Run Code Online (Sandbox Code Playgroud)
当我在服务器上加载任何URL(例如http://something.be)时,加载时间为141毫秒:
$ phantomjs phantomjs.js http://something.be
starting
Loading time 141 msec
Run Code Online (Sandbox Code Playgroud)
有没有人知道是什么导致我的连接变慢?连接本身很好,wget需要几秒钟才能下载几MB的文件.
此外,当我在OSX本地运行OSX上完全相同的脚本时,这是输出:
phantomjs phantomjs.js http://google.com/
starting
Loading time 430 msec
Run Code Online (Sandbox Code Playgroud) 我目前正在尝试通过访问app.php来使用我们的(基本)Symfony 2应用程序.但是,每当我尝试访问app.php时,都会收到错误500.我检查了日志,生产日志为空.我在配置文件中尝试了资产条目,但无济于事.谁有任何想法如何解决这个问题?
这是一个非常基本的应用程序(目前),只有一些路由更改和一个新的控制器.大部分是html(作为测试),所以它不能是我们迄今为止编写的php.
--edit:我目前没有指向/ web目录的documentroot,但我没有服务器的管理员权限.但是,因为该应用程序在app_dev.php中工作,我不知道这可能是一个什么问题?
我有一个查询从表中选择产品.产品可以有多种价格(考虑各种价格)和默认价格.
当然,这是一对多的关系.我需要选择具有给定价格或默认价格的产品 - 这意味着相互排斥.我知道这可以通过单独的查询和WHERE(非)IN子句或union语句来完成,但我确信必须有一种更优化的方式.我的查询目前看起来像这样:
SELECT products.*, products_prices.price
FROM products RIGHT JOIN
products_prices ON (products.id = products_prices.productId)
WHERE products_prices.businessId = ?
OR products_prices.businessId IS NULL // this needs to become mutual.
Run Code Online (Sandbox Code Playgroud)
编辑:我最终使用了这个查询,这是Gordon Linoff的略微修改版本:
SELECT distinct p.*, coalesce(pp.price, defpp.price)
FROM products p LEFT JOIN
products_prices pp
ON p.id = pp.productId and pp.businessId = ? left join
products_prices defpp
on p.id = defpp.productId and defpp.businessId is NULL
Run Code Online (Sandbox Code Playgroud)