php,.htaccess,laravel,cpanelRelated issues-Collection of common programming errors
Eugene
php session memcached redundancy
Colleagues! I’m running php 5.3 (5.3.8) with memcache (2.2.6) client library (http://pecl.php.net/package/memcache) to deal with memcached server. My goal is to have failover solution for sessions engine, namely:Only native php sessions support (no custom handlers) Few memcached servers in the poolWhat I expect is that in case if one of memcached servers is down, php will attempt to utilize the second server in the pool [will successfully connect it and become happy], however when first memcache
Răzvan Panda
php postback
If I pass PHP variables with ‘.’ in their names via $_GET PHP auto-replaces them with ‘_’ characters. For example:<?php echo “url is “.$_SERVER[‘REQUEST_URI’].”<p>”; echo “x.y is “.$_GET[‘x.y’].”.<p>”; echo “x_y is “.$_GET[‘x_y’].”.<p>”;… outputs the following:url is /SpShipTool/php/testGetUrl.php?x.y=a.b x.y is . x_y is a.b…. my question is this: is there any way I can get this to stop ? Cannot for the life of me figure out what I’ve done to deserve this 🙁 PHP version
user3439338
php wordpress apache .htaccess mod-rewrite
I want to redirect domainA.com/folder/ which originates within an older wordpress installtion to domainB.com/folder1/folder2/ which is the link to the page within my new wordpress installation wihtout the url changing. I have managed to achieve this with the .htaccess file inside domainA.com/folder/ which reads:RewriteEngine On RewriteCond %{REQUEST_URI} ^/folder RewriteRule ^(.*)$ http://www.domainB.com/folder1/folder2/ [P] The Rewriterule [P] (proxy) flag does what I want and redirects the pag
Matej
php json odbc sqldatatypes
I want to return a JSON object from a database (MyTable) which contains two columns – ID (int) and Name (string).The script below produces a JSON like:[{“ID”:”0″,”Name”:”John”},{“ID”:”1″,”Name”:”Doe”}]You can see, that the ID is returned as a string. How can I accomplish it in a way that an ID would be returned as integer:[{“ID”:0,”Name”:”John”},{“ID”:1,”Name”:”Doe”}]I do not want to read and parse the result array from the ODBC since I want to use generic queries like:SELECT * FROM TableXXXHere
JaSk
php doctrine symfony-1.4
While following the symfony tutorial (1.4.4) I’m getting an error with ODBC/mssql 2008.SQLSTATE[07002]: COUNT field incorrect: 0 [Microsoft][SQL Server Native Client 10.0]COUNT field incorrect or syntax error (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254). Failing Query: “SELECT [j].[id] AS [j__id], [j].[category_id] AS [j__category_id], [j].[type] AS [j_type], [j].[company] AS [j_company], [j].[logo] AS [j_logo], [j].[url] AS [j_url], [j].[position] AS [j_position], [j].[location] AS [j_locati
logan
php phpexcel
I am using PHPExcel (found here: https://github.com/PHPOffice/PHPExcel). If i try to read more than approximately 2000 rows then it shows memory error as follows.Fatal error: Allowed memory size of 134217728 bytes exhausted (triedto allocate 71 bytes) in/home/sample/PHPExcelReader/Classes/PHPExcel/worksheet.php on line 89My Excel data range is A1:X2000Below is my code used to read the excel.ini_set(‘memory_limit’, ‘-1’); /** Include path **/set_include_path(get_include_path() . PATH_SEPARATOR .
Shawn
php exception doctrine2
This is the relevant code:throw new Exception(“Message”);And this is the error message I get:Fatal error: require() [function.require]: Failed opening required’C:\wamp\www\drupal-7.15\sites\all\modules\dbManip\Entities\Exception.php'(include_path=’.;C:\wamp\bin\php\php5.3.13\pear\’) inC:\wamp\bin\php\php5.3.13\pear\Doctrine\Common\ClassLoader.php on line163I believe Doctrine is trying to load the Exception class definition as if it were just another entity of mine, but as far as I know, Exceptio
l008com
php ping icmp
I’m trying to do actual, genuine ping using ICMP packets, natively in PHP. Right now I’m using exec to run the ping command, but you never quite know what it’s going to output, which makes it very hard to format the results for web. Different network setups can result in some crazy output. So I wrote my own pinger using socket_create() (with help from the manual comments), but that also doesn’t work. Apparently you can’t create a raw socket unless your apache server is running as root. That’s no
Phil Cross
php linux apache ownership
I currently manage 8 different sites for my organisation and built a central management website to help manage the content on them all. I currently have a file uploader on the administration website that allows me to upload ZIP files to the server. This script then unzips the package, and moves the files to different parts of the server. The problem is, when I upload files through the browser, it assigns ownership to apache (for both user and group). This causes me a problem when I try to overwr
Andrew
php mysql date strtotime
In my vaguely large app, I get dates from the MySQL database all the time, and until today, where and when I formatted them with PHP’s date() command was random. I wanted to tidy that up today and move it all entirely to the view, rather than the retrieval. But I ran into some problems. My method so far has been, when getting a date from the database, I pass it to the rest of the app after running strtotime() on it, so that the date() functions have something they can work with. So, question the
user3439338
php wordpress apache .htaccess mod-rewrite
I want to redirect domainA.com/folder/ which originates within an older wordpress installtion to domainB.com/folder1/folder2/ which is the link to the page within my new wordpress installation wihtout the url changing. I have managed to achieve this with the .htaccess file inside domainA.com/folder/ which reads:RewriteEngine On RewriteCond %{REQUEST_URI} ^/folder RewriteRule ^(.*)$ http://www.domainB.com/folder1/folder2/ [P] The Rewriterule [P] (proxy) flag does what I want and redirects the pag
fiscme
.htaccess mod-rewrite
amongst my rules i have..RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&submenu=$2&info=$3&id=$4 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&submenu=$2&info=$3 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index
Fred -ii-
php html .htaccess
I’m looking for a working php script that will work to log/save attempted username and password combinations to access my protected .htpasswd file (the .htaccess file is redirecting people to this php scripted file). I found this one:<?php define(‘LOGINS_LOG’,’/web/user/log-htpasswd.log’);if(isset($_ENV[‘REDIRECT_REMOTE_USER’]) && !empty($_ENV[‘REDIRECT_REMOTE_USER’])){$fp = fopen(LOGINS_LOG, ‘a+’);fwrite($fp, $_ENV[‘REDIRECT_REMOTE_USER’]);fclose($fp); }ob_start(); header(“HTTP/1.1 4
Adrian Brown
.htaccess mod-rewrite
Ive got a image cache system that im using to generate certain image sizes as require. Im using modrewrite to check for the file and call the image creation system if it doesnt exist. The problem im having is that it is calling the image creation system even if the image does exist!The modrewrite is simple enough (sites in the images sub directory)RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /images/index.php?id=$1 [L,QSA]I even tri
user3362073
javascript php .htaccess
I want to change my filename.php to filename/ through .htaccesss. So, http://labs.ksj-oepites-zomergem.be/info.php#/deleiding should become http://labs.ksj-oepites-zomergem.be/info/#/deleiding What I’ve got: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase /# To externally redirect /dir/foo.php to /dir/foo RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L,NC]## To internally redirect /dir/foo to /dir/foo.php RewriteCond %{REQUES
LazyOne
zend-framework .htaccess redirect error-handling
I developed a website using Zend Framework. In order to handle errors, I want to add to the htaccess file the following lines so I can redirect the user to the corresponding every time there is an error.ErrorDocument 500 /errors/500.html ErrorDocument 404 /errors/404.html ErrorDocument 403 /errors/403.htmlso my htaccess file now in the /public folder looks like this:RewriteEngine on # Rewrite rules for Zend FrameworkRewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php# Security: Don’t al
user1443519
osx .htaccess
I’m using Mac OS X Lion and I can’t open any htaccess files or view them in finder. I’d like to be able to view hidden files, so I tried defaults write com.apple.finder AppleShowAllFiles TRUE followed by killall Finder but that did nothing.I logged in as the root user. Then I tried open /path/to/.htaccess but it wouldn’t open. It gave me a message like/Applications/XAMPP/xamppfiles/htdocs/.htaccess: line 1: syntax error near unexpected token `newline’ /Applications/XAMPP/xamppfiles/htdocs/.htacc
Greg
.htaccess mod-rewrite
This seems so simple, but I can’t figure it out… I would like all requests to be rewritten to index.php (which will interpret the request) apart from 404.html which should be rewritten directly to 404.php.The following code does work at rewriting everything to index.php, but 404.php never gets triggered.I have left line 3 commented because I don’t know what it does.Options +FollowSymlinks RewriteEngine on #RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^404.html$ 404.php [L] RewriteRule ^(.*)
Sumurai8
php forms .htaccess mod-rewrite url-rewriting
i have problem with mod rewritei made htaccess to convert url from php to htmland every thing finebut problem is some file i dont need to convert like form.phpthis is my htaccessRewriteCond %{REQUEST_URI} !^(.*)form.php(.*)$ RewriteCond %{REQUEST_URI} !^(.*)sitemap\.xml(.*)$ RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^/]+)\.php\s RewriteRule .* %1.html [R=301,L] RewriteRule ^([^/]*)\.html$ $1.php RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule ^.*$ – [L] RewriteRule ^index.php$ http://%{http_host}
Harish
apache .htaccess mod-rewrite
What is the difference betweenRedirectPermanent and RewriteRulei came across a codeRewriteRule ^coaching/([^/]+)/?$ search_result.php?categoryName=$1 [NC,L]another setting is RedirectPermanent “/coaching/Run to live” http://www.example.com/coachingThe former rule breaks my setting i can’t remove that too.It makes the output like thishttp://www.example.com/coaching?categoryName=Run%20to%20liveWhat should be added so that without changing first code i can acheive the resulthttp://www.example.co
johnnyfittizio
php html redirect laravel laravel-4
This is the situation:In my Laravel 4 app, after validating, it redirect to the same page displaying a succesfull message. It works fine. The problem is that the page is quite heavy and so the redirecting process it takes up to 3 seconds. What i would like to do, is to display a message without redirecting. In order to save the time that takes to load the page again, and display the message instantly.This is the code:return Redirect::back()->with(‘message’,'<b>Congratulations! You have
Antonio Carlos Ribeiro
laravel laravel-4
I have problems understanding how Laravel handles exceptions. I registered Exception handlers in global.php like this: use MyNamespace\Custom\Exceptions\NotAllowedException; App::error(function(NotAllowedException $exception, $code) {die(“MyNamespace\Custom\Exceptions\NotAllowedException catched”); });App::error(function(\Exception $exception) {echo “general exception thrown<br/>”; });In a controller action I now throw a NotAllowedException. The strange part however is, that first Exce
Antonio Carlos Ribeiro
php laravel laravel-4 composer-php
I’m running into issues installing Laravel 4… I am following the instructions posted here:http://badubizzle.blogspot.com/2013/01/setting-up-laravel-4-on-webfaction.htmlMy host allows multiple versions of PHP to run at the same time, so running the command php will run php 5.2.17 on whatever you specify next. I know you need greater than php 5.3 to run Laravel 4, so I am using php 5.4 to do so. I can either specifically type php54 to run the command under php 5.4, or an alias can be made in t
Marco Rivadeneyra
laravel laravel-4 eloquent
I have a table Books: with an ID (int) and a ISBN (string) the ISBN is a unique key. I have another table where I store the isbn for the book. On the book model I have: $this->hasMany(‘Other’, ‘isbn’, ‘isbn’); But that ignores the isbn. Do you know any way of doing this?Temporary fix:$this->primaryKey = ‘isbn’; return $this->hasMany(‘Other’, ‘isbn’);
Antonio Carlos Ribeiro
php laravel laravel-4 crud
I’m just playing around with Laravel at the moment, trying to work out if it is a good choice of framework to use for a project.I’ve downloaded the generator bundle from here and created a resource, following the documentation.This gives me a form with author and body.The store method that gets generated looks like this:/*** Store a newly created resource in storage.** @return Response*/public function store(){$input = Input::all();$validation = Validator::make($input, Tweet::$rules);if ($valida
skcin7
laravel laravel-4
I’m getting an unexplained FatalErrorException when trying to implement a simple page layout using blade templating. I’m not sure if it’s something I’m doing wrong or Laravel is. I’m following the tutorial on L4’s documentation about Templating and my code seems to follow it. Here’s my code.app/routes.php:<?php Route::get(‘/’, ‘HomeController@showWelcome’);app/views/home/welcome.blade.php:@extends(‘layouts.default’) @section(‘content’)<h1>Hello World!</h1> @stopapp/views/layouts/d
dasper
wordpress laravel laravel-4 eloquent
Laravel 4 is giving me unexpected results on a new project. To try and help me better understand the results I tried what I thought would be a simple exercise and use a friends old WordPress blog on his web hosting.Post model:class Post extends Eloquent {protected $table = ‘wp_posts’;public function meta(){return $this->hasMany(‘Meta’, ‘post_id’);} }Meta modelclass Meta extends Eloquent {protected $table = ‘wp_postmeta’;public function post(){return $this->belongsTo(‘Post’);} }I have tried
sqren
php ubuntu laravel vmware-fusion
In my setup source files are located on the host machine (Mac OSX) and shared to the guest (Ubuntu Server). When files are added to the host from the guest, syntax errors will occur on the last line of the file – even though no syntax errors are present.Example: Laravel Artisan commandsAll of the following commands are run from the Ubuntu (guest)First time, this will work fine:php artisanI can also rebuild the source files just fine:php artisan dump-autoloadHowever, as the files have been rebuil
johnnyfittizio
html forms twitter-bootstrap laravel laravel-4
I have to define a checkbox within a Laravel 4 app. But at the same time it is a Bootstrap 2.3.1 site, and i need to pass also Input::old How can i do it?This is how it was in html:<label class=”checkbox”><input type=”checkbox” name=”extraBed” value=”extra” /><span class=”blue”><strong class=”blue”><span><i class=”icon-plus”></i></span> Extra bed</span></label>This is how i have tried to write in Laravel4:<label class=”checkbox”>
BigJobbies
laravel laravel-4
Understanding models is doing my head in.Below is my complete model<?phpclass Pmconversation extends Eloquent {protected $table = ‘pm_conversations’;public function getPrivateMessages() {$userId = Auth::user()->id;$messages = DB::table(‘pm_conversations’)->where(function($query) use ($userId) {$query->where(‘user_one’, $userId)->where(‘user_one_archived’, 0);})->orWhere(function($query) use ($userId) {$query->where(‘user_two’, $userId)->where(‘user_two_archived’, 0)})->
Unnikrishnan
centos ruby cpanel redmine gem
I am trying to install redmine . I am using cpanel. I know cpanel wont support rails 3 which latest cpanel uses. So i downgraded my rails version and also i am trying to install redmine 1.4.3 which is an old version. I followed many docs. But at last, when i execute bundle install –without development testit shows, The source :rubygems is deprecated because HTTP requests are insecure. Please change your source to ‘https://rubygems.org’ if possible, or ‘http://rubyg
raven_kg
centos php nginx cpanel
I am using nginx with php-fpm on CentOS 6 with cPanel. I have no installed modules like eAccelerator or APC. Server periodically returns 404 and 502 errors. 404 errors occur when the PHP cannot correctly read the settings from config.php file and redirects to install.php page (action provided by installed php scripts) with requested page uri as root directory (WTF?!). Example, requested /some/page-num will be redirected to /some/page-num/install.php. config.php file exists and still readable by
tanaydin
php cpanel
While accessing PHP files in my server it prevents to execute PHP files. Image and text files etc can be browsed. When I try to browse PHP file it gives the following error:The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did notproduce any output. If there was an error, you should be able to seeit in the error log.The .htaccess file is empty, I can access the cpanel but have no idea whats wrong.
NewUser
nginx webserver cpanel
I want to know how to install Nginx server on cpanel. It has installed apache already. Now I want to remove apache and install Nginx on it. So can some one please guide me in that. Any help and suggestions will be highly appreciable.
Pikk
shell cron mysqldump cpanel
I am configuring Cron to backup my sql automatically. However I think that Cron has some issues and it’s not working well.This is the command I am running:mysqldump –opt -Q -uhereisthename -p’hereisthepasswordwithstrangecharactersthatmustbeescaped’ databasename | gzip > /home2/username/backups/backupnamefolder/backupdbwebsitename.`date +”%Y-%m-%d”`.gzWhen I run it via SSH it works fine and generates the backup. However if I run it via Cron, I get the following error:/bin/sh: -c: line 0: unex
mythofechelon
mysql database cpanel
I know of the potential risks.The only “useful” thing I’ve been able to find after Google-ing is this, on the cPanel website, which has no context whatsoever.Does anyone know how to do this?My version of cPanel is 11.32.2 (build 28).
user176749
backup cpanel
Ok so I have a website that I host with a provider that has a beautiful compression program built into the cpanel that is usually terrific at creating stable home directory & database backups using the .tar.gz file format.My issue is that when a website is large, for example the one I’m working with now is approximately 6gigs (Disk Usage 6699.73MB) I have not been able to find an acceptable method to simply backup a website of this size (and please don’t say don’t make them that big; we didn
MightyExcalibur
iptables centos5 cpanel linux-networking csf
I have a Centos5 web server which installed with CSF as firewall and CPanel as control panel.Random disconnections happening for months and i don’t know what is configured wrong.At first i thought it can be related with my software which written by me. But right now i think this is a configuration error and is not related with my software.Because i tested a simple idea: uploading a 117mb file to server with WinSCP. As you may know WinSCP is a very stable software, so it would complete whole uplo
Luka
cpanel
As you know or you do not know, cPanel with his update cron does automatically “yum update” and he updated the kernel etc. So, can I know somehow when he updates it, so I can reboot my server, I do not want to check it manually everyday… I have too much servers, or I need to reboot it regular once at month? Any solution?
Jeff
php quotes cpanel
I have a vps with cPanel/Whm/CentOS 5.5 and the problem is that all parameters sent to my server are being addslashed, I’ve checked out the PHP configuration and i found out that all the magic quotes are turned off and i don’t know what causes this.My code is so clean and i know every bit of it and i don’t have any addslashes() or some sort of these functions. i only want to receive the parameters as they are.URL: test.php?text=blah” ‘ ” ‘blah<?php echo $_GET[“text”]; // Output blah\” \’ \” \
Web site is in building